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