Symlink raw files into a redux directory
Format string for the DATE-OBS and UT keys from the fits files
Format for converting DATE_HEAD_KEY into a datetime instance
Format for converting a datetime instance into as string used as directory name
Symlink shots in the directory ‘path’ to an output redux directory. Format of redux directory follows issue 820 <https://luna.mpe.mpg.de/redmine/issues/820>
redux_name is a unique name for this reduction. It is set to the current date and time if not specified. Each reduction puts its own folder called redux_name under.
Adds flt, sci, cmp, bias directories to config object after creation. In this way you can run the code without symlinking and just fill in the needed directories in the config file instead. After creating the required directories loops over all the fits files in that night and puts them in a sensible place.
Parameters: | log_message : string
redux_name : string
|
---|
Scan the redux directories updating the ‘shot_name.txt’ file if the redux directory has changed and filling the database
Parameters: | redux_dir : string
|
---|
Run the symlinking from the raw to the redux directory
Parameters: | raw_dir, redux_dir : string
|
---|
Create the redux directory for the shot and symlink all the files from the shot directory
Parameters: | shot_dir : string
redux_dir : string
|
---|---|
Raises: | :class:`~vdat.utilities.VDATFitsTypeError`
|
Symlink the science shots
Parameters: | fits_files : list of strings
vdat_dir : vdat.database.VDATDir instance
|
---|---|
Returns: | out_vdat_dir : vdat.database.VDATDir instance
|
Symlink the bias shots.
Parameters: | fits_files : list of strings
vdat_dir : vdat.database.VDATDir instance
|
---|---|
Returns: | out_vdat_dir : vdat.database.VDATDir instance
|
Symlink the calibration, flat and arc, shots.
Flats and arcs taken together goes into the same directory.
If the shot is already symlinked, reuse the directory
order them at increasing time distance and take the nearest one: if it’s within a maximum time distance, symlink into that directory
Otherwise create a new directory and symlink into it
Parameters: | fits_files : list of strings
vdat_dir : vdat.database.VDATDir instance
|
---|---|
Returns: | out_vdat_dir : vdat.database.VDATDir instance
|
Create the directory.
If it exists, log it as error and, if failsafe is False, re-raise the exception
Parameters: | dirname : string
log : logging.Logging instance
safe : bool, optional
|
---|---|
Raises: | :class:`~vdat.utilities.VDATDirError` if the creation fails with a :class:`OSError` and ``failsafe`` is False |
Symlink the files into the target directory.
If it exists, log it as error and, if failsafe is False, re-raise the exception
Parameters: | file_list : list of strings
target_dir : string
log : logging.Logging instance
safe : bool, optional
|
---|---|
Raises: | :class:`~vdat.utilities.VDATSymlinkError` if the symlink creation fails with a :class:`OSError` and ``failsafe`` is False |
Average the list of timestamps.
Parameters: | dates : list of strings
infmt : strings, optional
outfmt : string, optional
|
---|---|
Returns: | avg_timestamp : datetime.datetime instance
string
|
Raises: | :class:`~vdat.utilities.VDATDateError`
|
Go through the list of query results, order them according to the absolute distance from timestamp and return the n_nearest.
Parameters: | q : peewee.SelectQuery
timestamp : datetime instance
n_nearest : int, optional
nearest_then : timedelta instance
|
---|---|
Returns: | sorted_q : list of query results
|
Deal with loggers
Setup the main vdat logger.
Add to the logger called name a standard output and a file logger
Parameters: | conf : ConfigParser instance
|
---|
Create a handler using the instructions in the configuration section and add it to the logger.
It looks for the following options:
Parameters: | logger : Logger instance
conf : ConfigParser instance, optional
section : string, default
|
---|
Tweak the astropy logger removing the existing (stream) handlers and setting a new one if required
Parameters: | conf : ConfigParser instance
|
---|
Create/update the ginga logger removing existing handlers setting a new one if required
Parameters: | conf : ConfigParser instance
|
---|
Get the logger with name. The first time this function is called with a name, the logger writing to a file in the log directory and called name.log is created
Parameters: | name : string
|
---|---|
Returns: | logging.Logger instance string
Todo redo it when finishing the implementation of the command interpreter |
Set up the loggers for the commands connected or connectible to buttons
Extract the section and convert it to a dictionary.
If from_parent is a non empty list, it will get the name of the parent section, e.g. if section=logging.main.stdout, the parent section is logging. Then if any element in from_parent doesn’t exist in section, it tries to get to from the parent section. If it doesn’t exist there, it’s skipped.
Parameters: | conf : ConfigParser instance
section : string
|
---|---|
Returns: | dict |
Create a handler following the instructions contained in section
It looks for the following options:
Parameters: | conf : dict
|
---|---|
Returns: | None, if enabled is False StreamHandler: if not file name is given FileHandler: otherwise |
Try to convert level to int or to extract the level level from the logging module. If both fail, return the default.
See here for more info about logging levels.
Parameters: | level : string
|
---|---|
Returns: | int
|
Enqueue commands coming from users pushing buttons on the gui
Generic worker that runs the given function
Class to deal with the user pushing buttons in the GUI. Causes the buttons to add commands to a queue, specified by the set_queue command.
Attributes
queue | (vdat.gui.queue.Queue object) the queue the callback interacts with |
Set the queue that the callbacks post jobs too.
Parameters: | queue : vdat.gui.queue Queue object
|
---|
Factory function, used to generate functions to attach to objects.
Parameters: | name : String
alias : String
immediate : bool (optional)
|
---|