morphfits.config#
Configure and setup a program execution of the MorphFITS program.
Attributes#
Classes#
Configuration model for a single FICL. |
|
Configuration model for a program execution of MorphFITS. |
Functions#
|
Create a MorphFITS configuration object from hierarchically preferred |
Module Contents#
- morphfits.config.logger#
Logger object for this module.
- morphfits.config.LowerStr#
Lowercase string type for pydantic model.
- class morphfits.config.FICL(/, **data: Any)#
Bases:
pydantic.BaseModel
Configuration model for a single FICL.
FICL is an abbreviation for the field, image version, catalog version, and filter of a JWST science observation. Each FICL corresponds to a single observation.
- Parameters:
BaseModel (class) – Base pydantic model class for type validation.
- field#
Field of observation, e.g. “abell2744clu”.
- Type:
str
- image_version#
Version string of JWST image processing, e.g. “grizli-v7.2”.
- Type:
str
- catalog_version#
Version string of JWST cataloging, e.g. “dja-v7.2”.
- Type:
str
- filter#
Observational filter band, e.g. “f140w”.
- Type:
str
- objects#
Integer IDs of galaxies or cluster targets in catalog, e.g. [1003, 6371].
- Type:
list[int]
- pixscale#
Pixel scale along x and y axes, in arcseconds per pixel.
- Type:
tuple[float, float]
Notes
All strings are converted to lowercase upon validation.
- field: Annotated[str, StringConstraints(to_lower=True)]#
- image_version: Annotated[str, StringConstraints(to_lower=True)]#
- catalog_version: Annotated[str, StringConstraints(to_lower=True)]#
- filter: Annotated[str, StringConstraints(to_lower=True)]#
- objects: list[int]#
- pixscale: tuple[float, float]#
- __str__() str #
Return str(self).
- class morphfits.config.MorphFITSConfig(/, **data: Any)#
Bases:
pydantic.BaseModel
Configuration model for a program execution of MorphFITS.
- Parameters:
BaseModel (class) – Base pydantic model class to enforce type validation upon creation.
- input_root#
Path to root input directory.
- Type:
Path
- output_root#
Path to root output directory.
- Type:
Path
- product_root#
Path to root products directory.
- Type:
Path
- run_root#
Path to root runs directory.
- Type:
Path
- datetime#
Datetime at start of program run.
- Type:
datetime
- run_number#
Number of run ordering runs with the same datetime.
- Type:
int
- fields#
List of fields over which to fit.
- Type:
list[str]
- image_versions#
List of image versions over which to fit.
- Type:
list[str]
- filters#
List of filters over which to fit.
- Type:
list[str]
- catalog_versions#
List of catalog versions over which to fit, by default only the v7.2 DJA catalog.
- Type:
list[str], optional
- objects#
List of object IDs within the catalog over which to fit, by default empty (all items in catalog).
- Type:
list[int], optional
- morphfits_root#
Path to root directory containing all of input, product, and output directories, by default the repository root.
- Type:
Path, optional
- wrappers#
List of morphology fitting algorithms to run, by default only GALFIT.
- Type:
list[str], optional
- galfit_path#
Path to GALFIT binary, by default None.
- Type:
Path
- input_root: pathlib.Path#
- output_root: pathlib.Path#
- product_root: pathlib.Path#
- run_root: pathlib.Path#
- datetime: datetime.datetime#
- run_number: int#
- fields: list[str]#
- image_versions: list[str]#
- filters: list[str]#
- catalog_versions: list[str] = ['dja-v7.2']#
- objects: list[int] = []#
- morphfits_root: pathlib.Path#
- wrappers: list[str] = ['galfit']#
- galfit_path: pathlib.Path = None#
- get_FICLs(pre_input: bool = False) Generator[FICL, None, None] #
Generate all FICL permutations for this configuration object, and return those with the necessary input files.
- Parameters:
pre_input (bool, optional) – Skip file checks if this function is called prior to download.
- Yields:
FICL – FICL permutation with existing input files.
- setup_paths(display_progress: bool = False, pre_input: bool = False)#
Create product and output directories for each FICLO of this configuration object.
- Parameters:
display_progress (bool, optional) – Display setup progress via tqdm, by default False.
pre_input (bool, optional) – Skip file checks if this function is called prior to download.
- clean_paths(display_progress: bool = False)#
Remove product and output directories for skipped FICLOs of this configuration object.
- Parameters:
display_progress (bool, optional) – Display cleaning progress via tqdm, by default False.
- write()#
Write configurations settings for a program run to a YAML file in the corresponding run directory.
- morphfits.config.create_config(config_path: str | pathlib.Path | None = None, morphfits_root: str | pathlib.Path | None = None, input_root: str | pathlib.Path | None = None, output_root: str | pathlib.Path | None = None, product_root: str | pathlib.Path | None = None, run_root: str | pathlib.Path | None = None, fields: list[str] | None = None, image_versions: list[str] | None = None, catalog_versions: list[str] | None = None, filters: list[str] | None = None, objects: list[int] | None = None, wrappers: list[str] | None = None, galfit_path: str | pathlib.Path | None = None, display_progress: bool = False, download: bool = False) MorphFITSConfig #
Create a MorphFITS configuration object from hierarchically preferred variables, in order of values from
CLI call from terminal
Specified config file,
Filesystem discovery
- Parameters:
config_path (str | Path | None, optional) – Path to user config yaml file, by default None (no user config file provided).
morphfits_root (str | Path | None, optional) – Path to root directory of MorphFITS filesystem, by default None (not passed through CLI).
input_root (str | Path | None, optional) – Path to root directory of input products, e.g. catalogs, science images, and PSFs, by default None (not passed through CLI).
output_root (str | Path | None, optional) – Path to root directory of GALFIT output products, e.g. morphology model and plots, by default None (not passed through CLI).
product_root (str | Path | None, optional) – Path to root directory of products generated by this program to execute GALFIT, e.g. cutouts/stamps, masks, and feedfiles, by default None (not passed through CLI).
run_root (str | Path | None, optional) – Path to root directory of records generated by this program for each run, by default None (not passed through CLI).
fields (list[str] | None, optional) – List of fields over which to execute GALFIT, by default None (not passed through CLI).
image_versions (list[str] | None, optional) – List of image versions over which to execute GALFIT, by default None (not passed through CLI).
catalog_versions (list[str] | None, optional) – List of catalog versions over which to execute GALFIT, by default None (not passed through CLI).
filters (list[str] | None, optional) – List of filter bands over which to execute GALFIT, by default None (not passed through CLI).
objects (list[int] | None, optional) – List of target IDs over which to execute GALFIT, for each catalog, by default None (not passed through CLI).
wrappers (list[str], optional) – List of morphology fitting algorithms to run, by default only GALFIT.
galfit_path (str | Path | None, optional) – Path to GALFIT binary file, by default None (not passed through CLI).
display_progress (bool, optional) – Display progress via tqdm, by default False.
download (bool, optional) – Create configuration in download mode, i.e. create directory structure if missing, by default False.
- Returns:
A configuration object for this program execution.
- Return type: