diff --git a/.gitignore b/.gitignore index 99973173..2e8aa51f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ pip-wheel-metadata # Sphinx docs/api docs/_build +docs/auto_examples +docs/sg_execution_times.rst # Eclipse editor project files .project diff --git a/docs/_static/astropy.css b/docs/_static/astropy.css index cc8280e0..ee3a3be1 100644 --- a/docs/_static/astropy.css +++ b/docs/_static/astropy.css @@ -1,46 +1,12 @@ /* Copied from astropy repo */ /* Main page overview cards */ -.sd-card { - background: #fff; - border-radius: 0; - padding: 30px 10px 20px 10px; - margin: 10px 0px; -} - -.sd-card .sd-card-header { - text-align: center; -} - -.sd-card .sd-card-header .sd-card-text { - margin: 0px; -} - .sd-card .sd-card-img-top { height: 52px; width: 52px; margin-left: auto; margin-right: auto; -} - -.sd-card .sd-card-header { - border: none; - background-color: white; - color: #150458 !important; - font-size: var(--pst-font-size-h5); - font-weight: bold; - padding: 2.5rem 0rem 0.5rem 0rem; -} - -.sd-card .sd-card-footer { - border: none; - background-color: white; -} - -.sd-card .sd-card-footer .sd-card-text { - max-width: 220px; - margin-left: auto; - margin-right: auto; + margin-top: 10px; } /* Dark theme tweaking */ @@ -48,32 +14,6 @@ html[data-theme=dark] .sd-card img[src*='.svg'] { filter: invert(0.82) brightness(0.8) contrast(1.2); } -/* Main index page overview cards */ -html[data-theme=dark] .sd-card { - background-color:var(--pst-color-background); -} - -html[data-theme=dark] .sd-shadow-sm { - box-shadow: 0 .1rem 1rem rgba(250, 250, 250, .6) !important -} - -html[data-theme=dark] .sd-card .sd-card-header { - background-color:var(--pst-color-background); - color: #150458 !important; -} - -html[data-theme=dark] .sd-card .sd-card-footer { - background-color:var(--pst-color-background); -} - -html[data-theme=dark] h1 { - color: var(--pst-color-primary); -} - -html[data-theme=dark] h3 { - color: #0a6774; -} - /* Flip the colours on graphviz graphs on dark mode */ html[data-theme="dark"] div.graphviz > object.inheritance { filter: invert(0.82) brightness(0.8) contrast(1.2); diff --git a/docs/conf.py b/docs/conf.py index bfac3937..296d183c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -69,7 +69,10 @@ """ # extensions += ["sphinxcontrib.autodoc_pydantic"] - +extensions += [ + "sphinx_design", + "sphinx_gallery.gen_gallery", +] # -- Project information ------------------------------------------------------ # This does not *have* to match the package name, but typically does diff --git a/docs/dev/index.rst b/docs/dev/index.rst index 997fd506..d31a70f1 100644 --- a/docs/dev/index.rst +++ b/docs/dev/index.rst @@ -1,5 +1,5 @@ -Contributing to ``stellarphot`` -------------------------------- +Contributing +------------ Installation for one-time testing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -109,3 +109,8 @@ Some specific examples settings moving_code + +.. toctree:: + :hidden: + + testing_installation diff --git a/docs/dev/testing_installation.rst b/docs/dev/testing_installation.rst new file mode 100644 index 00000000..a620e582 --- /dev/null +++ b/docs/dev/testing_installation.rst @@ -0,0 +1,9 @@ +Trying out test releases +######################## + +Thanks for being willing to try out a test release! We strongly recommend that you do this in a virtual +environment. If you don't have one set up, you can create one with `conda` or `mamba` (use whichever one you have installed):: + + mamba create -n stellarphot-test python=3.11 + mamba activate stellarphot-test + pip install --pre stellarphot diff --git a/docs/index.rst b/docs/index.rst index 1bf3d7e7..9bb9092b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,117 +1,99 @@ -Documentation -============= - Stellarphot is a package for performing photometry on calibrated (reduced) astronomical images. It provides a simple interface for performing aperture photometry of either a single image or a directory with multiple images. It is designed to be easy to use for both non-programmers and programmers. -Installation -============ - -If you are testing a pre-release version of stellarphot we recommend setting up -a virtual environment and installing stellarphot in this environment. - -Only use one of the methods below for making a virtual environment. - -Creating an environment with `conda` or `mamba` (use whichever one you have installed):: - - mamba create -n stellarphot-test python=3.11 - mamba activate stellarphot-test - pip install --pre stellarphot - -Creating an environment with `virtualenv`:: - - python -m venv stellarphot-test - source stellarphot-test/bin/activate - pip install --pre stellarphot -To install stellarphot without creating an environment, use:: +.. grid:: 1 1 2 2 - pip install --pre stellarphot + .. grid-item-card:: + :padding: 2 + :text-align: center -You can remove stellarphot with:: + **Testing stellarphot?** + ^^^ - pip uninstall stellarphot + Are you testing a pre-relase version of stellarphot? + There are special installation instructions for you. -Getting Started -=============== + .. button-ref:: dev/testing_installation + :expand: + :color: primary + :click-parent: -Overview --------- + To the pre-release testing instructions -You will go through this process to do photometry. + .. grid-item-card:: + :padding: 2 + :text-align: center -#. You need to make some settings, like camera properties, observatory information, and passband maps. You may only need - to do this step once if you use the same equipment for all of your observations. -#. Settings specific to an object need to be made: + **Getting Started?** + ^^^ - #. night of data, like the photometry aperture radius, need to be made. - #. a list of the sources for which you want to perform photometry. These lists can be re-used. + Installation instructions and a walk though of the process of doing photometry. -#. Review all of the settings that the photometry routines will use. -#. Once those settings have been done, you can perform photometry on your images. + .. button-ref:: stellarphot/getting_started + :expand: + :color: primary + :click-parent: + To the Getting Started guide -Graphical interface for making settings and doing photometry ------------------------------------------------------------- -A graphical interface is provided via JupyterLab to make settings. To start JupyterLab, run the following command -in a terminal:: + .. grid-item-card:: + :padding: 2 + :text-align: center - jupyter lab + **User guide** + ^^^ -If you open up JupyterLab, the launcher should have a section that looks like this: + A guide to using stellarphot, including how to make settings and perform photometry. -.. image:: /_static/launcher.png - :width: 400px - :alt: JupyterLab Launcher with stellarphot notebooks + .. button-ref:: stellarphot/user_guide/index + :expand: + :color: primary + :click-parent: -Each of the notebooks corresponds to the steps in the previous section. Open each notebook in order, and run -all of the cells in the notebook. In each will be a graphical interface to enter the camera and other settings -(in notebook 1), measuring the seeing and choose comparison stars (in notebook 2), review all of your settings -(in notebook 3), and perform photometry (in notebook 4). + To the user guide -When the photometry is done there will be a new notebook called `photometry_run.ipynb` that will have a record -of the photometry that was done. + .. grid-item-card:: + :padding: 2 + :text-align: center -Editing a settings file directly --------------------------------- + **Reference** + ^^^ -The settings file is a JSON file that can be edited in any text editor. + Detailed descriptions of every class and function in stellarphot. + .. button-ref:: stellarphot/api_reference + :expand: + :color: primary + :click-parent: -Performing photometry from within a Python script -------------------------------------------------- + To the API reference -Once you have made your settings doing photometry is a two line process. First, you -create a photometry object:: + .. grid-item-card:: + :padding: 2 + :text-align: center - from stellarphot.photometry import AperturePhotometry - from stellarphot.settings import PhotometryWorkingDirSettings - photometry_settings = PhotometryWorkingDirSettings().load() - phot = AperturePhotometry(settings=photometry_settings) + **Contributing** + ^^^ -Then you can perform photometry on a single image:: + Thanks for your interest in contributing to stellarphot. Click here to learn how to get started. - phot(image) - -If you have a directory of images you can perform photometry on all of them at once like this:: - - phot(directory, object_of_interest="M13") + .. button-ref:: dev/index + :expand: + :color: primary + :click-parent: + To the contributing guide .. toctree:: - :maxdepth: 3 + :maxdepth: 1 + :hidden: - stellarphot/index.rst + stellarphot/getting_started.rst + stellarphot/user_guide/index.rst stellarphot/settings.rst - - -Developer Documentation -======================= - -.. toctree:: - :maxdepth: 1 - - dev/index.rst + stellarphot/api_reference.rst + dev/index.rst diff --git a/docs/stellarphot/api_reference.rst b/docs/stellarphot/api_reference.rst new file mode 100644 index 00000000..569cbe4c --- /dev/null +++ b/docs/stellarphot/api_reference.rst @@ -0,0 +1,20 @@ +.. _api_reference: + +Reference/API +############# + +All of the classes and functions defined in `stellarphot` are listed below, grouped by module. + +.. automodapi:: stellarphot +.. automodapi:: stellarphot.core +.. automodapi:: stellarphot.differential_photometry +.. automodapi:: stellarphot.gui_tools +.. automodapi:: stellarphot.io +.. automodapi:: stellarphot.photometry.photometry +.. automodapi:: stellarphot.photometry.source_detection +.. automodapi:: stellarphot.plotting +.. automodapi:: stellarphot.transit_fitting +.. automodapi:: stellarphot.transit_fitting.gui +.. automodapi:: stellarphot.transit_fitting.io +.. automodapi:: stellarphot.transit_fitting.plotting +.. automodapi:: stellarphot.utils diff --git a/docs/stellarphot/getting_started.rst b/docs/stellarphot/getting_started.rst new file mode 100644 index 00000000..d2843824 --- /dev/null +++ b/docs/stellarphot/getting_started.rst @@ -0,0 +1,96 @@ +Getting started +############### + +Installation +============ + +If you are testing a pre-release version of stellarphot we recommend setting up +a virtual environment and installing stellarphot in this environment. + +Only use one of the methods below for making a virtual environment. + +Creating an environment with `conda` or `mamba` (use whichever one you have installed):: + + mamba create -n stellarphot-test python=3.11 + mamba activate stellarphot-test + pip install --pre stellarphot + +Creating an environment with `virtualenv`:: + + python -m venv stellarphot-test + source stellarphot-test/bin/activate + pip install --pre stellarphot + +To install stellarphot without creating an environment, use:: + + pip install --pre stellarphot + +You can remove stellarphot with:: + + pip uninstall stellarphot + +Overview +======== + +You will go through this process to do photometry: + +#. You need to make some equipment-related settings, like camera properties, observatory information, and passband maps. You may + only need to do this step once if you use the same equipment for all of your observations. +#. Settings specific to an object need to be made: + + #. Some settings, like the photometry aperture size, may need to be changed for each night. + #. Others, like a list of the sources for which you want to perform photometry in a particular + field, can be reused. + +#. Review all of the settings that the photometry routines will use. +#. Once those settings have been done, you can perform photometry on your images. + + +Graphical interface for making settings and doing photometry +============================================================ + +A graphical interface is provided via JupyterLab to make settings. To start JupyterLab, run the following command +in a terminal:: + + jupyter lab + +If you open up JupyterLab, the launcher should have a section that looks like this: + +.. image:: /_static/launcher.png + :width: 400px + :alt: JupyterLab Launcher with stellarphot notebooks + +Each of the notebooks corresponds to the steps in the previous section. Open each notebook in order, and run +all of the cells in the notebook. In each will be a graphical interface to enter the camera and other settings +(in notebook 1), measuring the seeing and choose comparison stars (in notebook 2), review all of your settings +(in notebook 3), and perform photometry (in notebook 4). + +When the photometry is done there will be a new notebook called `photometry_run.ipynb` that will have a record +of the photometry that was done. + +Editing a settings file directly +================================ + +The settings file is a JSON file that can be edited in any text editor. A sample setting +file is below, along with the JSON schema, which is a formal description of the settings file. + +.. include:: ../auto_examples/index.rst + +Performing photometry from within a Python script +================================================= + +Once you have made your settings doing photometry is a two line process. First, you +create a photometry object:: + + from stellarphot.photometry import AperturePhotometry + from stellarphot.settings import PhotometryWorkingDirSettings + photometry_settings = PhotometryWorkingDirSettings().load() + phot = AperturePhotometry(settings=photometry_settings) + +Then you can perform photometry on a single image:: + + phot(image) + +If you have a directory of images you can perform photometry on all of them at once like this:: + + phot(directory, object_of_interest="M13") diff --git a/docs/stellarphot/index.rst b/docs/stellarphot/index.rst deleted file mode 100644 index 802a4902..00000000 --- a/docs/stellarphot/index.rst +++ /dev/null @@ -1,35 +0,0 @@ -************************* -stellarphot Documentation -************************* - -This is the documentation for stellarphot. - -Photometry objects always have these attributes, also available dictionary-style: - -+ ``mag`` -- the calibrated magnitude; may be missing (e.g. your data prior to calibration) -+ ``mag_err`` -- error in ``mag`` -+ ``inst_mag`` -- the instrumental magnitude; may be missing (e.g. catalog data) -+ ``inst_mag_err`` -- error int the ``inst_mag`` -+ ``band`` -- the filter of the magnitude; required -+ ``BJD`` -- Barycentric Julian Date of the midpoint of the observation; may be missing/masked -+ ``RA2000`` -- right ascension in degrees, in the ICRS frame at epoch 2000 -+ ``DEC2000`` -- declination in degrees in the ICRS frame at epoch 2000 - -There may be additional fields. - -Reference/API -============= - -.. automodapi:: stellarphot -.. automodapi:: stellarphot.core -.. automodapi:: stellarphot.differential_photometry -.. automodapi:: stellarphot.gui_tools -.. automodapi:: stellarphot.io -.. automodapi:: stellarphot.photometry.photometry -.. automodapi:: stellarphot.photometry.source_detection -.. automodapi:: stellarphot.plotting -.. automodapi:: stellarphot.transit_fitting -.. automodapi:: stellarphot.transit_fitting.gui -.. automodapi:: stellarphot.transit_fitting.io -.. automodapi:: stellarphot.transit_fitting.plotting -.. automodapi:: stellarphot.utils diff --git a/docs/stellarphot/settings.rst b/docs/stellarphot/settings.rst index 0cbdd00c..b0513b22 100644 --- a/docs/stellarphot/settings.rst +++ b/docs/stellarphot/settings.rst @@ -1,5 +1,5 @@ -Settings -======== +Photometry Settings +=================== Overview -------- diff --git a/docs/stellarphot/user_guide/calibrating_photometry.rst b/docs/stellarphot/user_guide/calibrating_photometry.rst new file mode 100644 index 00000000..c2c0b50c --- /dev/null +++ b/docs/stellarphot/user_guide/calibrating_photometry.rst @@ -0,0 +1,2 @@ +Calibrating Photometry +###################### diff --git a/docs/stellarphot/user_guide/doing_photometry.rst b/docs/stellarphot/user_guide/doing_photometry.rst new file mode 100644 index 00000000..b65f00e1 --- /dev/null +++ b/docs/stellarphot/user_guide/doing_photometry.rst @@ -0,0 +1,2 @@ +Performing Aperture Photometry +############################## diff --git a/docs/stellarphot/user_guide/index.rst b/docs/stellarphot/user_guide/index.rst new file mode 100644 index 00000000..7ef2af50 --- /dev/null +++ b/docs/stellarphot/user_guide/index.rst @@ -0,0 +1,9 @@ +User guide +########## + +.. toctree:: + :maxdepth: 2 + + doing_photometry.rst + using_photometry_data.rst + calibrating_photometry.rst diff --git a/docs/stellarphot/user_guide/using_photometry_data.rst b/docs/stellarphot/user_guide/using_photometry_data.rst new file mode 100644 index 00000000..94829020 --- /dev/null +++ b/docs/stellarphot/user_guide/using_photometry_data.rst @@ -0,0 +1,15 @@ +Working with Photometry Data +############################# + +Photometry objects always have these attributes, also available dictionary-style: + ++ ``mag`` -- the calibrated magnitude; may be missing (e.g. your data prior to calibration) ++ ``mag_err`` -- error in ``mag`` ++ ``inst_mag`` -- the instrumental magnitude; may be missing (e.g. catalog data) ++ ``inst_mag_err`` -- error int the ``inst_mag`` ++ ``band`` -- the filter of the magnitude; required ++ ``BJD`` -- Barycentric Julian Date of the midpoint of the observation; may be missing/masked ++ ``RA2000`` -- right ascension in degrees, in the ICRS frame at epoch 2000 ++ ``DEC2000`` -- declination in degrees in the ICRS frame at epoch 2000 + +There may be additional fields. diff --git a/examples/GALLERY_HEADER.rst b/examples/GALLERY_HEADER.rst new file mode 100644 index 00000000..6fd73900 --- /dev/null +++ b/examples/GALLERY_HEADER.rst @@ -0,0 +1,2 @@ +Settings examples +================= diff --git a/examples/plot_example_settings.py b/examples/plot_example_settings.py new file mode 100644 index 00000000..de832103 --- /dev/null +++ b/examples/plot_example_settings.py @@ -0,0 +1,11 @@ +""" +Example Photometry Settings +=========================== + +A sample set of photometry settings. +""" + +from stellarphot.settings import photometry_settings_example + +model_json = photometry_settings_example.model_dump_json(indent=4) +print(model_json) diff --git a/examples/plot_schema.py b/examples/plot_schema.py new file mode 100644 index 00000000..6a2d36aa --- /dev/null +++ b/examples/plot_schema.py @@ -0,0 +1,13 @@ +""" +JSON Schema for Photometry Settings +=================================== + +The JSON schema for photometry settings is here. +""" + +import json + +from stellarphot.settings import photometry_settings_schema + +json_schema = json.dumps(photometry_settings_schema, indent=4) +print(json_schema) diff --git a/pyproject.toml b/pyproject.toml index 5d9af6ce..25f0efd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ dependencies = [ docs = [ "sphinx", "sphinx-astropy[confv2]", + "sphinx-design", "graphviz", ] exo_fitting = [ diff --git a/stellarphot/settings/__init__.py b/stellarphot/settings/__init__.py index a8247d1b..3154b82e 100644 --- a/stellarphot/settings/__init__.py +++ b/stellarphot/settings/__init__.py @@ -1,3 +1,15 @@ from .models import * from .settings_files import * from .views import * + +# For conveniences, provide the JSON schema and an example of PhotometrySettings. +photometry_settings_schema = PhotometrySettings.model_json_schema() # noqa: F405 + +from .tests.test_models import TEST_PHOTOMETRY_SETTINGS + +photometry_settings_example = PhotometrySettings( # noqa: F405 + **TEST_PHOTOMETRY_SETTINGS +) + +# Clean up the namespace +del TEST_PHOTOMETRY_SETTINGS diff --git a/stellarphot/settings/models.py b/stellarphot/settings/models.py index b8c6aae2..f79749dd 100644 --- a/stellarphot/settings/models.py +++ b/stellarphot/settings/models.py @@ -219,7 +219,17 @@ class Camera(BaseModelWithTableRep): """ - model_config = MODEL_DEFAULT_CONFIGURATION + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + + # WHen a subclass has a ConfigDict it is merged with the parent class's + # ConfigDict. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) name: Annotated[ NonEmptyStr, @@ -345,6 +355,18 @@ class PhotometryApertures(BaseModelWithTableRep): ... ) """ + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + + # WHen a subclass has a ConfigDict it is merged with the parent class's + # ConfigDict. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) + radius: Annotated[ PositiveInt, Field( @@ -483,6 +505,18 @@ class Observatory(BaseModelWithTableRep): """ + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + + # WHen a subclass has a ConfigDict it is merged with the parent class's + # ConfigDict. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) + name: Annotated[ NonEmptyStr, Field(description="Name of the observatory", examples=["My Observatory"]), @@ -580,6 +614,18 @@ class SourceLocationSettings(BaseModelWithTableRep): shift_tolerance=5.0) """ + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + + # WHen a subclass has a ConfigDict it is merged with the parent class's + # ConfigDict. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) + source_list_file: Annotated[ str, Field( @@ -668,6 +714,18 @@ class PhotometryOptionalSettings(BaseModelWithTableRep): False """ + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + + # WHen a subclass has a ConfigDict it is merged with the parent class's + # ConfigDict. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) + include_dig_noise: Annotated[ bool, Field( @@ -731,6 +789,15 @@ class PassbandMapEntry(BaseModel): """ + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) + your_filter_name: Annotated[ NonEmptyStr, Field(description="Instrumental Filter Name") ] @@ -788,6 +855,18 @@ class PassbandMap(BaseModelWithTableRep): """ + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + + # WHen a subclass has a ConfigDict it is merged with the parent class's + # ConfigDict. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) + name: Annotated[ NonEmptyStr, Field( @@ -867,6 +946,18 @@ class LoggingSettings(BaseModelWithTableRep): LoggingSettings(logfile=None, console_log=True) """ + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + + # WHen a subclass has a ConfigDict it is merged with the parent class's + # ConfigDict. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) + logfile: Annotated[str | None, Field(description="File to save log to")] = None console_log: Annotated[bool, Field(description="Show log on console?")] = True @@ -877,9 +968,6 @@ class LoggingSettings(BaseModelWithTableRep): class PhotometrySettings(BaseModelWithTableRep): """ Settings for performing aperture photometry. - """ - - """ Parameters ---------- @@ -914,9 +1002,18 @@ class PhotometrySettings(BaseModelWithTableRep): """ - # Title must be set below for now to ensure the UI looks good. May be able to be - # removed once this bug is fixed: - # https://github.com/maxfordham/ipyautoui/issues/290 + # This ensures that just the first line of the docstring is used as the + # model description. The json schema is really hard to read if the + # description is too long. + + # WHen a subclass has a ConfigDict it is merged with the parent class's + # ConfigDict. + model_config = ConfigDict( + json_schema_extra=dict( + description=_extract_short_description(__doc__), + ) + ) + camera: Annotated[ Camera, Field( diff --git a/stellarphot/utils/magnitude_transforms.py b/stellarphot/utils/magnitude_transforms.py index 3f272b21..53d864f9 100644 --- a/stellarphot/utils/magnitude_transforms.py +++ b/stellarphot/utils/magnitude_transforms.py @@ -11,7 +11,7 @@ from ..core import apass_dr9 __all__ = [ - "f", + "calibrated_from_instrumental", "opts_to_str", "calc_residual", "filter_transform", @@ -21,7 +21,7 @@ ] -def f(X, a, b, c, d, z): +def calibrated_from_instrumental(X, a, b, c, d, z): """ Calculate the calibrated magnitudes from the instrumental magnitudes and colors. @@ -649,7 +649,12 @@ def transform_to_catalog( # Do the fit popt, pcov = curve_fit( - f, X, catm - offset, p0=init_guess, bounds=fit_bounds, sigma=errors + calibrated_from_instrumental, + X, + catm - offset, + p0=init_guess, + bounds=fit_bounds, + sigma=errors, ) # Accumulate the parameters @@ -657,13 +662,13 @@ def transform_to_catalog( param.extend([value] * len(one_image)) # Calculate and accumulate residual - residual = calc_residual(f(X, *popt) + offset, catm) + residual = calc_residual(calibrated_from_instrumental(X, *popt) + offset, catm) resids.extend([residual] * len(one_image)) # Calculate calibrated magnitudes and accumulate, settings ones with # no catalog match to NaN X = (mag_inst, color) - cal_mag = f(X, *popt) + cal_mag = calibrated_from_instrumental(X, *popt) if fit_diff: cal_mag = cal_mag + X[0] bad_match = d2d.arcsecond > 1