morphfits.wrappers.galfit#

Main program execution for the GALFIT morphology fitter wrapper package.

Attributes#

logger

Logging object for this module.

FLAGS

GALFIT flags as written in the model headers, and their corresponding

FAIL

GALFIT flags which indicate a failed run.

GALFIT_LOG_REGEX

GALFIT_LOG_FLOAT_REGEX

Regex for seven .2f numbers found in GALFIT logs, which may or may not be

Functions#

generate_feedfiles(input_root, product_root, ...[, ...])

Generate feedfiles for all objects in a FICL.

run_galfit(→ list[str])

Run GALFIT over all objects in a FICL.

record_parameters(return_codes, datetime, run_number, ...)

Record GALFIT fitting parameters to the corresponding run directory.

main(morphfits_config[, regenerate_products, ...])

Orchestrate GalWrap functions for passed configurations.

Module Contents#

morphfits.wrappers.galfit.logger#

Logging object for this module.

morphfits.wrappers.galfit.FLAGS#

GALFIT flags as written in the model headers, and their corresponding bit-mask exponent, where 2 is the base.

morphfits.wrappers.galfit.FAIL = 495#

GALFIT flags which indicate a failed run.

See also

README.md

Breakdown on binary flag values, and which flags result in failed runs.

morphfits.wrappers.galfit.GALFIT_LOG_REGEX = '[\\*|\\[]?\\d{1,10}[\\.]\\d{1,2}[\\*|\\[]?'#
morphfits.wrappers.galfit.GALFIT_LOG_FLOAT_REGEX = '\\d{1,10}[\\.]\\d{1,2}'#

Regex for seven .2f numbers found in GALFIT logs, which may or may not be enveloped by * or [] characters.

See also

None

Function using this expression to record the fitting parameters from logs.

morphfits.wrappers.galfit.generate_feedfiles(input_root: pathlib.Path, product_root: pathlib.Path, output_root: pathlib.Path, field: str, image_version: str, catalog_version: str, filter: str, objects: list[int], image_sizes: list[int], pixscale: tuple[float, float], regenerate: bool = False, feedfile_template_path: pathlib.Path = GALFIT_DATA_ROOT / 'feedfile.jinja', constraints_path: pathlib.Path = GALFIT_DATA_ROOT / 'default.constraints', path_length: int = 64, float_length: int = 12, display_progress: bool = False)#

Generate feedfiles for all objects in a FICL.

Parameters:
  • input_root (Path) – Path to root MorphFITS input directory.

  • product_root (Path) – Path to root MorphFITS products directory.

  • output_root (Path) – Path to root MorphFITS output directory.

  • field (str) – Field of observation.

  • image_version (str) – Version of image processing used on observation.

  • catalog_version (str) – Version of cataloguing used for field.

  • filter (str) – Filter used for observation.

  • objects (list[str]) – List of object IDs in catalog for which to generate feedfiles.

  • image_sizes (list[int]) – List of image sizes corresponding to each object’s stamp.

  • pixscale (tuple[float, float]) – Pixel scale along x and y axes, in arcseconds per pixel.

  • regenerate (bool, optional) – Regenerate existing feedfiles, by default False.

  • feedfile_template_path (Path, optional) – Path to jinja2 feedfile template, by default from the repository data directory.

  • constraints_path (Path, optional) – Path to the GALFIT constraints file, by default from the repository data directory.

  • path_length (int, optional) – Length of path strings in the template for comment alignment, by default 64, so that comments start at column 69.

  • float_length (int, optional) – Length of float strings in the template for comment alignment, by default 12.

  • display_progress (bool, optional) – Display progress on terminal screen, by default False.

morphfits.wrappers.galfit.run_galfit(galfit_path: pathlib.Path, input_root: pathlib.Path, product_root: pathlib.Path, output_root: pathlib.Path, field: str, image_version: str, catalog_version: str, filter: str, objects: list[int], display_progress: bool = False) list[str]#

Run GALFIT over all objects in a FICL.

Parameters:
  • galfit_path (Path) – Path to GALFIT binary file.

  • input_root (Path) – Path to root MorphFITS input directory.

  • product_root (Path) – Path to root MorphFITS products directory.

  • output_root (Path) – Path to root MorphFITS output directory.

  • field (str) – Field of observation.

  • image_version (str) – Version of image processing used on observation.

  • catalog_version (str) – Version of cataloguing used for field.

  • filter (str) – Filter used for observation.

  • objects (list[str]) – List of object IDs in catalog for which to generate feedfiles.

  • display_progress (bool, optional) – Display progress on terminal screen, by default False.

Returns:

List of GALFIT return codes for each FICLO.

Return type:

list[int]

morphfits.wrappers.galfit.record_parameters(return_codes: list[int], datetime: datetime.datetime, run_number: int, output_root: pathlib.Path, run_root: pathlib.Path, field: str, image_version: str, catalog_version: str, filter: str, objects: list[int], display_progress: bool = False)#

Record GALFIT fitting parameters to the corresponding run directory.

Parameters:
  • return_codes (list[int]) – List of GALFIT return codes for each FICLO.

  • datetime (datetime) – Datetime of start of run.

  • run_number (int) – Number of run in runs directory when other runs have the same datetime.

  • output_root (Path) – Path to root MorphFITS output directory.

  • run_root (Path) – Path to root runs directory.

  • field (str) – Field of observation.

  • image_version (str) – Version of image processing used on observation.

  • catalog_version (str) – Version of cataloguing used for field.

  • filter (str) – Filter used for observation.

  • objects (list[str]) – List of object IDs in catalog for which to generate feedfiles.

  • display_progress (bool, optional) – Display progress on terminal screen, by default False.

  • for_run (bool, optional)

morphfits.wrappers.galfit.main(morphfits_config: morphfits.config.MorphFITSConfig, regenerate_products: bool = False, regenerate_stamps: bool = False, regenerate_psfs: bool = False, regenerate_masks: bool = False, regenerate_sigmas: bool = False, keep_feedfiles: bool = False, skip_products: bool = False, skip_fits: bool = False, make_plots: bool = False, display_progress: bool = False)#

Orchestrate GalWrap functions for passed configurations.

Parameters:
  • morphfits_config (MorphFITSConfig) – Configuration object for this program run.

  • regenerate_products (bool, optional) – Regenerate all products, by default False.

  • regenerate_stamps (bool, optional) – Regenerate stamps, by default False.

  • regenerate_masks (bool, optional) – Regenerate masks, by default False.

  • regenerate_psfs (bool, optional) – Regenerate psfs, by default False.

  • regenerate_sigmas (bool, optional) – Regenerate sigmas, by default False.

  • keep_feedfiles (bool, optional) – Reuse existing feedfiles, by default False.

  • skip_products (bool, optional) – Skip all product generation, by default False.

  • skip_fits (bool, optional) – Skip all morphology fitting via GALFIT, by default False.

  • make_plots (bool, optional) – Generate model plots, by default False.

  • display_progress (bool, optional) – Display progress as loading bar and suppress logging, by default False.