corgidrp.walker#

Attributes#

Functions#

walk_corgidrp(filelist, CPGS_XML_filepath, outputdir)

Automatically create a recipe and process the input filelist.

autogen_recipe(filelist, outputdir[, template])

Automatically creates a recipe (or recipes) by identifyng and populating a template.

guess_template(dataset)

Guesses what template should be used to process a specific image

save_data(dataset_or_image, outputdir[, suffix, ...])

Saves the dataset or image that has currently been outputted by the last step function.

run_recipe(recipe[, save_recipe_file])

Run the specified recipe

Module Contents#

corgidrp.walker.all_steps[source]#
corgidrp.walker.recipe_dir[source]#
corgidrp.walker.walk_corgidrp(filelist, CPGS_XML_filepath, outputdir, template=None)[source]#

Automatically create a recipe and process the input filelist. Does both the autogen_recipe and run_recipe steps.

Parameters:
  • filelist (list of str) – list of filepaths to files

  • CPGS_XML_filepath (str) – path to CPGS XML file for this set of files in filelist

  • outputdir (str) – output directory folderpath

  • template (str or json) – custom template. It can be one of three things * the full json object, * a filename of a template that’s already in the recipe_templates folder * a filepath to a template on disk somewhere

Returns:

the JSON recipe (or list of JSON recipes) that was used for processing

Return type:

json or list

corgidrp.walker.autogen_recipe(filelist, outputdir, template=None)[source]#

Automatically creates a recipe (or recipes) by identifyng and populating a template. Returns a single recipe unless there are multiple recipes that should be produced.

Parameters:
  • filelist (list of str) – list of filepaths to files

  • outputdir (str) – output directory folderpath

  • template (json) – enables passing in of custom template, if desired

Returns:

the JSON recipe (or list of recipes) that the input filelist will be processed with

Return type:

json list

corgidrp.walker.guess_template(dataset)[source]#

Guesses what template should be used to process a specific image

Parameters:

dataset (corgidrp.data.Dataset) – a Dataset to process

Returns:

the best template filename, a list of multiple template filenames, or a list of template chains bool: whether multiple recipes are chained together. If True, the output of the first recipe

should be used as the input to the second recipe. If False, the same input should be used for all recipes. This keyworkd is irrelevant if only a single recipe is returned.

Return type:

str or list

corgidrp.walker.save_data(dataset_or_image, outputdir, suffix='', ram_heavy_save=False)[source]#

Saves the dataset or image that has currently been outputted by the last step function. Records calibration frames into the caldb during the process

Parameters:
  • dataset_or_image (corgidrp.data.Dataset or corgidrp.data.Image) – data to save

  • outputdir (str) – path to directory where files should be saved

  • suffix (str) – optional suffix to tack onto the filename. E.g.: test.fits with suffix=”dark” becomes test_dark.fits

  • ram_heavy_save (bool) – If True, the input is assumed to have no data loaded into memory. (Only metadata was manipulated in step leading up to save_data.) The data is loaded from the filepath frame by frame, and each Image is saved to outputdir. Defaults to False.

corgidrp.walker.run_recipe(recipe, save_recipe_file=True)[source]#

Run the specified recipe

Parameters:
  • recipe (dict or str) – either the filepath to the recipe or the already loaded in recipe

  • save_recipe_file (bool) – saves the recipe as a JSON file in the outputdir (true by default)

Returns:

list of filepaths to the saved files, or None if no files were saved

Return type:

list