yafitss package

Submodules

yafitss.dataBlock module

class yafitss.dataBlock.DataBlock(logger, timer)[source]

Bases: object

A class to pack the content of a FITS file (IMAGE) and related data.

__palette_names

the palette names

Type

string list

__palette

to

Type

???

__default_palette_name

the default palette name

Type

str

__transformation_names

the transformation names

Type

str list

__default_transformation_name

the default transformation name

Type

str

__video_mode_names

the video mode names

Type

str list

__default_video_mode_name

the default video mode name

Type

str

__renderingCapabilities

the rendering capabilities

Type

dictionary

__dateTimeFormat

date time format

Type

str

__naxisn_rexp

a regulare expression to catch the NAXISn

Type

str

__max_idle

maximum idleness duration for an instance of DataBlock, retrieved from the env var YAFITSS_MAXIDLE

Type

float

RADECRangeInDegrees() → result.Result[source]
addHeaderToFits(iRA, iDEC, iRA1, iDEC1, data_spectrum, spectrumUnit)[source]

Create new fits HDU from the one given by the origin fits file :param iRA: first x coordinate :type iRA: str :param iDEC: first y coordinate :type iDEC: str :param iRA1: second x coordinate :type iRA1: str :param iDEC1: second y coordinate :type iDEC1: str :param data_spectrum: a table (x,y) of data used to create the spectrum :type data_spectrum: list :param spectrumUnit: selected unit of the average or simple spectrum :type spectrumUnit: str

Returns

hdu – Primary HDU of the spectrum

Return type

dictionary

classmethod convert_size(sizeInBytes)[source]

Convert size in byte format :param cls: :type cls: DataBlock :param sizeInBytes: :type sizeInBytes: int

Returns

a byte format

Return type

string

createFITSImage(iFREQ, iFREQ1, imageType, step=1)[source]
createFITSSliceImage0(iFREQ) → result.Result[source]
createFITSSumSliceImage0(iFREQ0, iFREQ1) → result.Result[source]
createFits(iRA, iDEC) → result.Result[source]
createOneSlice(iFREQ, Header, step)[source]
createSmoothCube(nbox)[source]
createSmoothCube0(nbox) → result.Result[source]
createSummedSlice(iFREQ0, iFREQ1, Header, step)[source]
property creationTime
degToHMSDMS(RAinDD, DECinDD) → result.Result[source]
getAverage(iFREQ0=None, iFREQ1=None, iDEC0=None, iDEC1=None, iRA0=None, iRA1=None) → result.Result[source]

Returns value at given position in summed slice. If value is NaN or does not exist, it is replaced by None to get a valid json document after conversion

Parameters
  • iFREQ0 (int) – Frequency of first slice

  • iFREQ1 (int) – Frequency of last slice

  • iDEC0 (int) – iDEC min

  • iDEC1 (int) – iDEC max

  • iRA0 (int) – iRA min

  • iRA1 (int) – iRA max

Returns

result

Return type

array

getAverageSpectrum(iDEC0=None, iDEC1=None, iRA0=None, iRA1=None) → result.Result[source]
getContours(iFREQ=None, iDEC0=None, iDEC1=None, iRA0=None, iRA1=None, **kwargs) → result.Result[source]
classmethod getDataBlockInfoNames()[source]
getDataBlockInfos(now, infoNames) → result.Result[source]
classmethod getDateTimeFormat()[source]
classmethod getDefaultITTName()[source]
classmethod getDefaultLUTName()[source]
classmethod getDefaultPaletteName()[source]
classmethod getDefaultTransformationName()[source]
classmethod getDefaultVMName()[source]
classmethod getDefaultVideoModeName()[source]
classmethod getDefaults()[source]
getDimensions() → result.Result[source]
classmethod getFITSFilePrefix()[source]
getHeader() → result.Result[source]
classmethod getIMGFilePrefix()[source]
classmethod getMaxIdle()[source]
classmethod getOBJFilePrefix()[source]
getOneSliceAsPNG(iFREQ, ittName='percent99', lutName='iram', vmName='direct') → result.Result[source]

Get One slice as a png image :param iFREQ: :type iFREQ: float

Returns

result

Return type

dictionary

classmethod getPNGFilePrefix()[source]
classmethod getPaletteFromName(name)[source]
getPixelValueAtiFreqiRAiDEC(iFreq, iRA, iDEC) → result.Result[source]
getPixelValueAtiRAiDEC(iRA: int, iDEC: int) → result.Result[source]
getPixelsValueAtiFreqiRAiDEC(iPositions) → result.Result[source]
classmethod getRenderingCapabilities()[source]
classmethod getSMOOTHFilePrefix()[source]
getSlice(iFREQ, step=1) → result.Result[source]
getSpectrum(iRA=None, iDEC=None, iFREQ0=None, iFREQ1=None) → result.Result[source]
getSumOverSliceRectArea(iFREQ, iRA0=None, iRA1=None, iDEC0=None, iDEC1=None) → result.Result[source]
getSummedSliceRangeAsPNG(iFREQ0, iFREQ1, ittName='percent99', lutName='iram', vmName='direct') → result.Result[source]
getlastAccess() → result.Result[source]
property header
property infod
is3D()[source]
property lastAccess
measureBox(iFREQ, iRA0=None, iRA1=None, iDEC0=None, iDEC1=None) → result.Result[source]
measureContour(iFREQ, contour, level) → result.Result[source]
property naxisn
rangeToDMS(iDEC0, iDEC1, iDECstep) → result.Result[source]
rangeToHMS(iRA0: int, iRA1: int, iRAstep) → result.Result[source]
property relFITSFilePath
setData(relFITSFilePath: str) → result.Result[source]

Given a FITS file path: read the content of the FITS file in memory and populates the instance variables accordingly

Parameters

relFITSFilePath (str) – a relative fits file path

Returns

a formated result

Return type

Result

Raises
  • KeyError – if the __header[“RESTFRQ”] does not exist

  • Exception – Error while opening fits file

classmethod setFITSFilePrefix(FITSFilePrefix)[source]
classmethod setIMGFilePrefix(IMGFilePrefix)[source]
setLastAccess()[source]

Set a lastAccess on self

classmethod setOBJFilePrefix(OBJFilePrefix)[source]
classmethod setPNGFilePrefix(PNGFilePrefix)[source]
classmethod setSMOOTHFilePrefix(SMOOTHFilePrefix)[source]
property sizeInBytes
slice_smbox_cube(incube, nbox)[source]
yafitss.dataBlock.cmap2palette(palette_name)[source]
yafitss.dataBlock.getLegendFilePath(pngFilePath)[source]
yafitss.dataBlock.isNanList(checked_list)[source]

Returns true if list contains only nan values

Parameters

checked_list (list) –

Returns

Return type

boolean

yafitss.dataManager module

class yafitss.dataManager.DataManagerImpl(logger: logging.Logger, timer: timer.Timer)[source]

Bases: object

RADECRangeInDegrees(relFITSFilePath) → result.Result[source]
createFITSSliceImage(relFITSFilePath, iFREQ) → result.Result[source]
createFITSSumSliceImage(relFITSFilePath, iFREQ0, iFREQ1) → result.Result[source]
createFits(relFITSFilePath, iRA, iDEC) → result.Result[source]
createSmoothCube(relFITSFilePath, nbox) → result.Result[source]
degToHMSDMS(relFITSFilePath, RAinDD, DECinDD) → result.Result[source]
getAverage(relFITSFilePath, iFREQ0, iFREQ1, iDEC0, iDEC1, iRA0, iRA1) → result.Result[source]
getAverageSpectrum(relFITSFilePath, iDEC0=None, iDEC1=None, iRA0=None, iRA1=None) → result.Result[source]
getContours(relFITSFilePath, iFREQ, iDEC0, iDEC1, iRA0, iRA1, **kwargs) → result.Result[source]
getDataBlockInfos() → result.Result[source]
getDimensions(relFITSFilePath) → result.Result[source]
getEntries(relKey)[source]
getHeader(relFITSFilePath) → result.Result[source]
getOneSliceAsPNG(iFREQ, relFITSFilePath, **kwargs) → result.Result[source]
getPixelValueAtiFreqiRAiDEC(relFITSFilePath: str, iFreq: int, iRA: int, iDEC: int) → result.Result[source]
getPixelValueAtiRAiDEC(relFITSFilePath: str, iRA: int, iDEC: int) → result.Result[source]
getPixelsValueAtiFreqiRAiDEC(relFITSFilePath: str, iPositions) → result.Result[source]
getSlice(relFITSFilePath, iFREQ, step=1) → result.Result[source]
getSpectrum(relFITSFilePath, iRA=None, iDEC=None, iFREQ0=None, iFREQ1=None) → result.Result[source]
getSumOverSliceRectArea(relFITSFilePath, iFREQ, iRA0=None, iRA1=None, iDEC0=None, iDEC1=None) → result.Result[source]
getSummedSliceRangeAsPNG(relFITSFilePath, iFREQ0, iFREQ1, **kwargs) → result.Result[source]
getYtObj(relFITSFilePath, product, coord)[source]
measureBox(relFITSFilePath, iFREQ, iRA0, iRA1, iDEC0, iDEC1) → result.Result[source]
measureContour(relFITSFilePath, iFREQ, contour, level) → result.Result[source]
purgeDataBlocks()[source]
rangeToDMS(relFITSFilePath: str, iDEC0: int, iDEC1: int, iDECstep: int) → result.Result[source]
rangeToHMS(relFITSFilePath, iRA0, iRA1, iRAstep) → result.Result[source]
renderingCapabilities() → result.Result[source]
setData(relFITSFilePath: str)[source]

yafitss.iramColors module

yafitss.log module

class yafitss.log.LogManager[source]

Bases: object

attachRotatingFileHandler(logger: logging.Logger, filePath: str)[source]

Attaches a RotatingFileHandler to the given logger. The output will be written in filePath

Parameters
  • logger (logging.Logger) – a Logger object

  • filepath (str) – The path of the file where log content will be written

property logBackupCount
property maxLogSize
yafitss.log.getLogger(name: str, filePath: str) → logging.Logger[source]

Returns a Logger object saving data in the file located at filePath and identified as name by a RotatingFileHandler

Parameters
  • name (str) – indentifier of logger for the RotatingFileHandler to which it will be attached

  • filePath (str) – path where log content will be written

Returns

logging.Logger

Return type

a Logger object instance

yafitss.lutColors module

class yafitss.lutColors.LUT(name)[source]

Bases: object

property colors
getColorMap()[source]
getReverseColorMap()[source]
getReversedColors(colors)[source]
property name
property reversecolors
setColors(colors)[source]
class yafitss.lutColors.LUTIram[source]

Bases: yafitss.lutColors.LUT

lutname = 'iram'
class yafitss.lutColors.LutFactory[source]

Bases: object

getLut(type)[source]

yafitss.pathManager module

yafitss.pathManager.getAbsFITSFilePath(relFITSFilePath)[source]
yafitss.pathManager.getSMOOTHFilePath(relFITSFilePath)[source]

yafitss.result module

class yafitss.result.Result[source]

Bases: object

property message
ok(result: Any)yafitss.result.Result[source]
property result
property status
toDict() → Dict[source]
toJSON() → str[source]
wrong(message: str)yafitss.result.Result[source]

yafitss.serverWsgi module

yafitss.serverWsgi.RADECRangeInDegrees(*args, **kwargs)[source]
yafitss.serverWsgi.byteify(input)[source]

A function to transform the content of a dictionary a unicode value into its ascii’s see https://stackoverflow.com/questions/956867/how-to-get-string-objects-instead-of-unicode-from-json

yafitss.serverWsgi.cleanNanInList(arr)[source]

Replaces NaN values by None in array

yafitss.serverWsgi.createFITSSliceImage(*args, **kwargs)[source]
yafitss.serverWsgi.createFITSSumSliceImage(*args, **kwargs)[source]
yafitss.serverWsgi.createFits(*args, **kwargs)[source]
yafitss.serverWsgi.createSmoothCube(*args, **kwargs)[source]
yafitss.serverWsgi.degToHMSDMS(*args, **kwargs)[source]
yafitss.serverWsgi.enable_cors(fn)[source]

enable cross domain ajax requests

yafitss.serverWsgi.getAverage(*args, **kwargs)[source]
yafitss.serverWsgi.getAverageSpectrum(*args, **kwargs)[source]
yafitss.serverWsgi.getBoolValue(value)[source]
yafitss.serverWsgi.getContours(*args, **kwargs)[source]
yafitss.serverWsgi.getDataBlockInfos(*args, **kwargs)[source]
yafitss.serverWsgi.getDimensions(*args, **kwargs)[source]
yafitss.serverWsgi.getEntries(*args, **kwargs)[source]
yafitss.serverWsgi.getFloatValue(value)[source]
yafitss.serverWsgi.getHeader(*args, **kwargs)[source]
yafitss.serverWsgi.getIntValue(value)[source]
yafitss.serverWsgi.getOneSliceAsPNG(*args, **kwargs)[source]
yafitss.serverWsgi.getPixelValueAtiFreqiRAiDEC(*args, **kwargs)[source]
yafitss.serverWsgi.getPixelValueAtiRAiDEC(*args, **kwargs)[source]
yafitss.serverWsgi.getPixelsValueAtiFreqiRAiDEC(*args, **kwargs)[source]
yafitss.serverWsgi.getSlice(*args, **kwargs)[source]
yafitss.serverWsgi.getSpectrum(*args, **kwargs)[source]
yafitss.serverWsgi.getSumOverSliceRectArea(*args, **kwargs)[source]
yafitss.serverWsgi.getSummedSliceRangeAsPNG(*args, **kwargs)[source]
yafitss.serverWsgi.getYtObj(*args, **kwargs)[source]
yafitss.serverWsgi.log_to_logger(fn)[source]

Wrap a Bottle request so that a log line is emitted after it’s handled. (This decorator can be extended to take the desired logger as a param.)

yafitss.serverWsgi.main(argv)[source]
yafitss.serverWsgi.measureBox(*args, **kwargs)[source]
yafitss.serverWsgi.measureContour(*args, **kwargs)[source]
yafitss.serverWsgi.purgeDataBlocks(*args, **kwargs)[source]
yafitss.serverWsgi.rangeToDMS(*args, **kwargs)[source]
yafitss.serverWsgi.rangeToHMS(*args, **kwargs)[source]
yafitss.serverWsgi.rebuildFilename(filename)[source]

Given filename ( string ) returns a string where each space character present in filename is replaced by ‘+’ character.

yafitss.serverWsgi.renderingCapabilities(*args, **kwargs)[source]
yafitss.serverWsgi.saveTest(*args, **kwargs)[source]
yafitss.serverWsgi.send_apidoc(filepath)[source]
yafitss.serverWsgi.send_fits(filepath)[source]
yafitss.serverWsgi.send_png(filepath)[source]
yafitss.serverWsgi.send_spectrum(filepath)[source]
yafitss.serverWsgi.setData(*args, **kwargs)[source]
yafitss.serverWsgi.upAnWaiting(*args, **kwargs)[source]

yafitss.tapquery module

class yafitss.tapquery.NedService[source]

Bases: yafitss.tapquery.TapService

getDefaultParameters()[source]
getDefaultQuery(parameters)[source]
query(adql_query)[source]
class yafitss.tapquery.ServiceFactory[source]

Bases: object

getServices() → set[source]
getTapService(service_name: str)yafitss.tapquery.TapService[source]
class yafitss.tapquery.TapService[source]

Bases: object

abstract getDefaultParameters()[source]
abstract getDefaultQuery(parameters)[source]
abstract query(adql_query)[source]

yafitss.timer module

class yafitss.timer.Timer(logger)[source]

Bases: object

addComment(message: str, prefix='')[source]

Add a simple comment to the logged content

Parameters
  • message (str) – text content that will be added to log content

  • prefix (str) – a prefix that will be written before message

start()[source]

Start a new timer

stop(message: str, prefix='')[source]

Stop the timer, and report the elapsed time

Parameters
  • message (str) – a message that will be added to the execution time

  • prefix (str) – a text that will be used as a prefix before message

exception yafitss.timer.TimerError[source]

Bases: Exception

A custom exception used to report errors in use of Timer class

Module contents