MuseRed

class musered.MuseRed(settings_file='settings.yml', report_format='txt', version=None, settings_kw=None, loglevel=None)[source]

Bases: musered.reporter.Reporter

The main class handling all MuseRed’s logic.

This class manages the database, and use the settings file, to provide all the methods to operate on the datasets.

Attributes Summary

calib_exposures

Return the calibration sequences (TPL.START) for each DPR_TYPE.

exposures

Return a dict of science exposure per target.

flags

Return the QAFlags object to manage flags.

nights

Return the list of nights for which data is available.

rawc

The SQLAlchemy columns object for the raw table.

runs

Return the list of runs for which data is available.

Methods Summary

clean([recipe_list, date_list, night_list, ...])

Remove database entries and files.

copy_reduced(version, recipes)

Copy reduced rows from another version.

exp_align(dataset[, recipe_name, filt, ...])

Compute offsets between exposures of a dataset.

exp_combine(dataset[, recipe_name, name, ...])

Combine exposures for a dataset.

export_images(recipe_name[, dataset, ...])

Export images as Image list, HDUs, or cube.

find_illum(night, ref_temp, ref_mjd_date)

Find the best ILLUM exposure for the night.

get_astropy_table(name[, indexes])

Return a table from the database as an astropy Table.

get_files(DPR_TYPE[, first_only, ...])

Return the list of files for a given DPR_TYPE and a query.

get_flagged(exclude_flags)

Return the list of flagged exposures.

get_processed([table, filter_names])

Return the list of processed names for a given query.

get_table(name)

Return the dataset.Table from the database.

info([date_list, run, filter_excludes, ...])

Print a summary of the raw and reduced data.

info_exp(expname[, full, recipes, show_weather])

Print information about a given exposure or night.

info_qc(dpr_type[, date_list])

info_raw(**kwargs)

Print information about raw exposures for a given night or type.

info_warnings([date_list, recipes, mode])

list_calibs()

Print the list of calibration sequences.

list_datasets()

Print the list of datasets.

list_exposures()

Print the list of exposures.

list_nights()

Print the list of nights.

list_runs()

Print the list of runs.

prepare_dates(dates[, DPR_TYPE, datecol, table])

Compute the list of dates (nights, exposures) to process.

process_calib(recipe_name[, dates, params_name])

Run a calibration recipe.

process_exp(recipe_name[, dates, dataset, ...])

Run a science recipe.

process_standard([recipe_name, dates])

Reduce a standard exposure.

select_column(name[, notnull, distinct, ...])

Select values from a column of the database.

select_dates([dpr_type, table, column, where])

Select the list of dates to process.

set_loglevel(level[, cpl])

Set the logging level for the root logger or the cpl logger.

show_images(recipe_name[, dataset, ...])

Show images on a grid.

std_combine(runs[, recipe_name, name, ...])

Combine std stars for a list of runs.

update_db([force])

Create or update the database containing FITS keywords.

update_qc([dpr_types, recipe_name, force])

Create or update the tables containing QC keywords.

Attributes Documentation

calib_exposures

Return the calibration sequences (TPL.START) for each DPR_TYPE.

exposures

Return a dict of science exposure per target.

flags

Return the QAFlags object to manage flags.

nights

Return the list of nights for which data is available.

rawc

The SQLAlchemy columns object for the raw table.

runs

Return the list of runs for which data is available.

Methods Documentation

clean(recipe_list=None, date_list=None, night_list=None, remove_files=True, force=False)[source]

Remove database entries and files.

copy_reduced(version, recipes)[source]

Copy reduced rows from another version.

This is needed to start a new version without reprocessing from the start. It allows to copy the database records from the previous version to the reduced table of the current version.

Parameters
versionstr

The version to copy from.

recipeslist of str

List of recipe names to copy.

exp_align(dataset, recipe_name='muse_exp_align', filt='white', params_name=None, name=None, exps=None, force=False, **kwargs)[source]

Compute offsets between exposures of a dataset.

Parameters
datasetstr

Dataset name.

recipe_namestr

Recipe to run: ‘muse_exp_align’ (DRS, default), or ‘imphot’.

filtstr

Filter to use for the images, only for muse_exp_align.

params_namestr

Name of the parameter block, default to recipe_name.

namestr

Name of the output record, default to ‘{dataset}_{recipe_name}’.

expslist of str

List of exposures to process. By default all exposures of the dataset are processed.

forcebool

Force processing if it was already done previously.

exp_combine(dataset, recipe_name='muse_exp_combine', name=None, params_name=None, force=False, **kwargs)[source]

Combine exposures for a dataset.

Parameters
datasetstr

Dataset name.

recipe_namestr

Recipe to run: ‘muse_exp_combine’ (DRS, default), or ‘mpdaf_combine’ (cube combination with MPDAF).

namestr

Name of the output record, default to ‘{dataset}_{recipe_name}’.

params_namestr

Name of the parameter block, default to recipe_name.

forcebool

Force processing if it was already done previously.

export_images(recipe_name, dataset=None, DPR_TYPE='IMAGE_FOV', filt='white', limit=None, outname=None, out='list', date=None)

Export images as Image list, HDUs, or cube.

Parameters
recipe_namestr

Recipe for which images are exported.

datasetstr, optional

Dataset for which images are exported.

DPR_TYPEstr, optional

Type of images to show.

filtstr, optional

Filter, default to white.

limitint

Maximum number of images to show.

outnamestr

Filename to save the FITS file.

out{‘list’, ‘cube’, ‘hdulist’}

Specify the output format, ‘list’ of images, ‘cube’ of images, or ‘hdulist’ with one extension per image.

datestr or list of str

List of dates for which images are exported.

find_illum(night, ref_temp, ref_mjd_date)[source]

Find the best ILLUM exposure for the night.

First, illums are sorted by date to find the closest one in time, then if there are multiple illums within 2 hours, the one with the closest temperature is used.

get_astropy_table(name, indexes=None)[source]

Return a table from the database as an astropy Table.

get_files(DPR_TYPE, first_only=False, remove_excludes=False, select=None, exclude_flags=None, return_explist=False, **clauses)[source]

Return the list of files for a given DPR_TYPE and a query.

Parameters
DPR_TYPEstr

DPR.TYPE of files to find.

first_onlybool

When an item gives several files, return only the first one.

remove_excludesbool

If True removes files that are listed in the exclude settings.

selectdict

Allows to make selection on any table. This should be a dict of (tablename, dict), where the dict value defines a query to make with dataset’s find method.

exclude_flagslist of flags

List of flags to exclude.

return_explistbool

If True, also return the list of exposure names.

**clauses

Parameters passed to self.reduced.find.

get_flagged(exclude_flags)[source]

Return the list of flagged exposures.

Parameters
exclude_flagslist or bool

List of flags, or True to use all flags.

get_processed(table='reduced', filter_names=None, **clauses)[source]

Return the list of processed names for a given query.

get_table(name)[source]

Return the dataset.Table from the database.

info(date_list=None, run=None, filter_excludes=True, header=True, show_tables=('raw', 'calib', 'science'))

Print a summary of the raw and reduced data.

info_exp(expname, full=True, recipes=None, show_weather=True)

Print information about a given exposure or night.

info_qc(dpr_type, date_list=None, **kwargs)
info_raw(**kwargs)

Print information about raw exposures for a given night or type.

info_warnings(date_list=None, recipes=None, mode='list')
list_calibs()

Print the list of calibration sequences.

list_datasets()

Print the list of datasets.

list_exposures()

Print the list of exposures.

list_nights()

Print the list of nights.

list_runs()

Print the list of runs.

prepare_dates(dates, DPR_TYPE=None, datecol='name', table='raw')[source]

Compute the list of dates (nights, exposures) to process.

process_calib(recipe_name, dates=None, params_name=None, **kwargs)[source]

Run a calibration recipe.

Parameters
recipe_namestr

Recipe to run.

datesstr or list of str

List of dates to process.

params_namestr

Name of the parameter block, default to recipe_name.

**kwargs

Additional arguments passed to _run_recipe_loop.

process_exp(recipe_name, dates=None, dataset=None, params_name=None, **kwargs)[source]

Run a science recipe.

Parameters
recipe_namestr

Recipe to run.

datesstr or list of str

List of dates to process.

datasetstr

If given, all exposures from this dataset are processed.

params_namestr

Name of the parameter block, default to recipe_name.

**kwargs

Additional arguments passed to _run_recipe_loop.

process_standard(recipe_name='muse_standard', dates=None, **kwargs)[source]

Reduce a standard exposure.

Running both muse_scibasic and muse_standard.

Parameters
recipe_namestr

Recipe to run.

datesstr or list of str

List of dates to process.

**kwargs

Additional arguments passed to _run_recipe_loop.

select_column(name, notnull=True, distinct=False, where=None, table='raw')[source]

Select values from a column of the database.

select_dates(dpr_type=None, table='raw', column='name', where=None, **kwargs)[source]

Select the list of dates to process.

set_loglevel(level, cpl=False)[source]

Set the logging level for the root logger or the cpl logger.

show_images(recipe_name, dataset=None, DPR_TYPE='IMAGE_FOV', filt='white', ncols=4, figsize=4, limit=None, date=None, catalog=None, zoom_center=None, zoom_size=None, **kwargs)

Show images on a grid.

Parameters
recipe_namestr

Recipe for which images are shown.

datasetstr, optional

Dataset for which images are shown.

DPR_TYPEstr, optional

Type of images to show.

filtstr, optional

Filter, default to white.

ncols4

Number of columns in the grid.

figsizefloat

Size of each subimage.

limitint

Maximum number of images to show.

datestr or list of str

List of dates for which images are shown.

catalogstr

Catalog to be plotted on images, needs ‘ra’ and ‘dec’ columns.

zoom_center(float, float)

Position (in pixels) on which to zoom in.

zoom_size(float, float)

Size (in pixels) of the zoom.

**kwargs

Additional parameters are passed to mpdaf.obj.Image.plot.

std_combine(runs, recipe_name='muse_std_combine', name=None, params_name=None, force=False, **kwargs)[source]

Combine std stars for a list of runs.

Parameters
runslist of str

List of run names.

recipe_namestr

Recipe to run: ‘muse_exp_combine’ (DRS, default), or ‘mpdaf_combine’ (cube combination with MPDAF).

namestr

Name of the output record, default to ‘{dataset}_{recipe_name}’.

params_namestr

Name of the parameter block, default to recipe_name.

forcebool

Force processing if it was already done previously.

update_db(force=False)[source]

Create or update the database containing FITS keywords.

update_qc(dpr_types=None, recipe_name=None, force=False)[source]

Create or update the tables containing QC keywords.