autocti


Nameautocti JSON
Version 2024.1.27.4 PyPI version JSON
download
home_pagehttps://github.com/jammy2211/PyAutoCTI
SummaryPyAutoCTI: Charge Transfer Inefficiency Modeling
upload_time2024-01-27 19:56:55
maintainer
docs_urlNone
authorJames Nightingale, Richard Massey, Jacob Kegerreis and Richard Hayes
requires_python>=3.7
licenseMIT License
keywords cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PyAutoCTI: Charge Transfer Inefficiency Modeling
================================================

.. |nbsp| unicode:: 0xA0
    :trim:

.. |RTD| image:: https://readthedocs.org/projects/pyautocti/badge/?version=latest
    :target: https://pyautocti.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. |Tests| image:: https://github.com/Jammy2211/PyAutoCTI/actions/workflows/main.yml/badge.svg
   :target: https://github.com/Jammy2211/PyAutoCTI/actions

.. |Build| image:: https://github.com/Jammy2211/PyAutoBuild/actions/workflows/release.yml/badge.svg
   :target: https://github.com/Jammy2211/PyAutoBuild/actions

.. |code-style| image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black

.. |arXiv| image:: https://img.shields.io/badge/arXiv-1708.07377-blue
    :target: https://arxiv.org/abs/0909.0507

|RTD| |Tests| |Build| |code-style| |arXiv|

`Installation Guide <https://pyautocti.readthedocs.io/en/latest/installation/overview.html>`_ |
`readthedocs <https://pyautocti.readthedocs.io/en/latest/index.html>`_ |
`What is CTI? <https://pyautocti.readthedocs.io/en/latest/overview/overview_1_what_is_cti.html>`_

Charge Transfer Inefficiency, or CTI for short, is an effect that occurs when acquiring imaging data from
Charge Coupled Devices (CCDs). Due to radiation damage to the CCD's silicon lattice electrons are read-out inefficiently,
creating a characteristic trailing or smearing effect.

Here is an example of CTI in the Hubble space telescope, after decades of radiation damage:

.. image:: https://raw.githubusercontent.com/Jammy2211/PyAutoCTI/main/docs/overview/images/what_is_cti.png
  :width: 600
  :alt: Alternative text

**PyAutoCTI** makes it simple to calibrate a time-varying CTI model using in-orbit observations and correct CTI in
science imaging using this model.

**PyAutoCTI** development is centred around mitigating CTI for the Euclid space mission, which relies on the precise
measurement of galaxy shapes in order to map out the distribution of dark matter throughout the Universe via a
phenomena called weak gravitational lensing.

Getting Started
---------------

The following links are useful for new starters:

- `The PyAutoCTI readthedocs <https://pyautocti.readthedocs.io/en/latest>`_, which includes `an installation guide <https://pyautocti.readthedocs.io/en/latest/installation/overview.html>`_ and an overview of **PyAutoCTI**'s core features.

- `The autocti_workspace GitHub repository <https://github.com/Jammy2211/autocti_workspace>`_, which includes example scripts.

API Overview
------------

To model CTI, **PyAutoCTI** wraps the library **arCTIc** (https://github.com/jkeger/arctic).

CTI can be added to an image as follows:

.. code-block:: python

    import autocti as ac

    """
    Define a pre-cti image which **PyAutoCTI** adds CTI to.
    """
    pre_cti_data_2d = ac.Array2D.no_mask(
                values=[
            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
        ],
        pixel_scales=0.1,
    )

    """
    A clocker object is used to model CCD clocking, which includes customization such
    as the properties of the read-out electronics.
    """
    clocker_2d = ac.Clocker2D(parallel_roe=ac.ROE())

    """
    CTI is caused by traps on the CCD's silicon lattice, for example traps which capture
    electrons instantaneously.
    """
    parallel_trap = ac.TrapInstantCapture(density=100.0, release_timescale=1.0)

    """
    CTI also depends on how electrons fill each pixel in a CCD, therefore we define
    the volume-filling properties of the CCD.
    """
    parallel_ccd = ac.CCDPhase(
        well_fill_power=0.58, well_notch_depth=0.0, full_well_depth=200000.0
    )

    """
    The data, traps and CCD properties are combined to clock the pre-CTI data and return the
    post-CTI data.
    """
    post_cti_data_2d = clocker_2d.add_cti(
        data=pre_cti_data_2d,
        parallel_trap_list=[parallel_trap],
        parallel_ccd=parallel_ccd
    )

    """
    We can use PyAutoCTI's built in visualization library to plot the data with CTI.
    """
    import autocti.plot as aplt

    array_2d_plotter = aplt.Array2DPlotterarray=post_cti_data_2d)
    array_2d_plotter.figure_2d()


With **PyAutoCTI**, you can begin calibrating a CTI model in minutes. The example below demonstrates a simple analysis
which fits a CTI model to charge injection imaging calibrate data (a form of data used to calibrate a CTI model)

.. code-block:: python

    import autofit as af
    import autocti as al
    import autocti.plot as aplt

    """
    Define the 2D shape of the charge injection image.
    """
    shape_native = (30, 30)

    """
    Define where the charge injection is on the data.
    """
    regions_list = [(0, 25, serial_prescan[3], serial_overscan[2])]

    """
    Setup the data layout which informs **PyAutoCTI** where information on 
    CTI is in the data.
    """
    layout = ac.Layout2DCI(
        shape_2d=shape_native,
        region_list=regions_list,
    )

    """
    Load the charge injection image from fits.
    """
    dataset = ac.ImagingCI.from_fits(
        data_path=path.join(dataset_path, f"data.fits"),
        noise_map_path=path.join(dataset_path, f"noise_map.fits"),
        pre_cti_data_path=path.join(dataset_path, f"pre_cti_data.fits"),
        layout=layout,
        pixel_scales=0.1,
    )

    """
    Again define the clocker which models CCD clocking and read-out electronics.
    """
    clocker_2d = ac.Clocker2D(parallel_roe=ac.ROE())

    """
    Define the traps in the CTI model and customize the priors of their free parameters.
    """
    trap = af.Model(ac.TrapInstantCapture)
    
    trap.density = af.UniformPrior(lower_limit=0.0, upper_limit=20.0)
    trap.release_timescale = af.UniformPrior(lower_limit=0.0, upper_limit=20.0)

    """
    Define the CCD filling behaviour of the CTI, which is also part of the model and is
    fitted for as free parameters.
    """
    parallel_ccd = af.Model(ac.CCDPhase)

    parallel_ccd.well_fill_power = af.UniformPrior(lower_limit=0.0, upper_limit=1.0)
    parallel_ccd.well_notch_depth = 0.0
    parallel_ccd.full_well_depth = 200000.0

    """
    We define the non-linear search used to fit the model to the data (in this case, Dynesty).
    """
    search = af.Nautilus(name="search[example]", n_live=50)

    """
    We next set up the `Analysis`, which contains the `log likelihood function` that the
    non-linear search calls to fit the cti model to the data.
    """
    analysis = ac.AnalysisImagingCI(dataset=dataset, clocker=clocker_2d)

    """
    To perform the model-fit we pass the model and analysis to the search's fit method. This will
    output results (e.g., dynesty samples, model parameters, visualization) to hard-disk.
    """
    result = search.fit(model=model, analysis=analysis)

    """
    The results contain information on the fit, for example the maximum likelihood
    model from the Dynesty parameter space search.
    """
    print(result.samples.max_log_likelihood())

Support
-------

Support for installation issues, help with cti modeling and using **PyAutoCTI** is available by
`raising an issue on the GitHub issues page <https://github.com/Jammy2211/PyAutoCTI/issues>`_.

We also offer support on the **PyAutoCTI** `Slack channel <https://pyautocti.slack.com/>`_, where we also provide the
latest updates on **PyAutoCTI**. Slack is invitation-only, so if you'd like to join send
an `email <https://github.com/Jammy2211>`_ requesting an invite.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jammy2211/PyAutoCTI",
    "name": "autocti",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "cli",
    "author": "James Nightingale, Richard Massey, Jacob Kegerreis and Richard Hayes",
    "author_email": "james.w.nightingale@durham.ac.uk",
    "download_url": "https://files.pythonhosted.org/packages/8c/0b/b1e615085017f3c69c1b6d9a9c0202cea71427f9687ab5d1f3853865c24c/autocti-2024.1.27.4.tar.gz",
    "platform": null,
    "description": "PyAutoCTI: Charge Transfer Inefficiency Modeling\n================================================\n\n.. |nbsp| unicode:: 0xA0\n    :trim:\n\n.. |RTD| image:: https://readthedocs.org/projects/pyautocti/badge/?version=latest\n    :target: https://pyautocti.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. |Tests| image:: https://github.com/Jammy2211/PyAutoCTI/actions/workflows/main.yml/badge.svg\n   :target: https://github.com/Jammy2211/PyAutoCTI/actions\n\n.. |Build| image:: https://github.com/Jammy2211/PyAutoBuild/actions/workflows/release.yml/badge.svg\n   :target: https://github.com/Jammy2211/PyAutoBuild/actions\n\n.. |code-style| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n\n.. |arXiv| image:: https://img.shields.io/badge/arXiv-1708.07377-blue\n    :target: https://arxiv.org/abs/0909.0507\n\n|RTD| |Tests| |Build| |code-style| |arXiv|\n\n`Installation Guide <https://pyautocti.readthedocs.io/en/latest/installation/overview.html>`_ |\n`readthedocs <https://pyautocti.readthedocs.io/en/latest/index.html>`_ |\n`What is CTI? <https://pyautocti.readthedocs.io/en/latest/overview/overview_1_what_is_cti.html>`_\n\nCharge Transfer Inefficiency, or CTI for short, is an effect that occurs when acquiring imaging data from\nCharge Coupled Devices (CCDs). Due to radiation damage to the CCD's silicon lattice electrons are read-out inefficiently,\ncreating a characteristic trailing or smearing effect.\n\nHere is an example of CTI in the Hubble space telescope, after decades of radiation damage:\n\n.. image:: https://raw.githubusercontent.com/Jammy2211/PyAutoCTI/main/docs/overview/images/what_is_cti.png\n  :width: 600\n  :alt: Alternative text\n\n**PyAutoCTI** makes it simple to calibrate a time-varying CTI model using in-orbit observations and correct CTI in\nscience imaging using this model.\n\n**PyAutoCTI** development is centred around mitigating CTI for the Euclid space mission, which relies on the precise\nmeasurement of galaxy shapes in order to map out the distribution of dark matter throughout the Universe via a\nphenomena called weak gravitational lensing.\n\nGetting Started\n---------------\n\nThe following links are useful for new starters:\n\n- `The PyAutoCTI readthedocs <https://pyautocti.readthedocs.io/en/latest>`_, which includes `an installation guide <https://pyautocti.readthedocs.io/en/latest/installation/overview.html>`_ and an overview of **PyAutoCTI**'s core features.\n\n- `The autocti_workspace GitHub repository <https://github.com/Jammy2211/autocti_workspace>`_, which includes example scripts.\n\nAPI Overview\n------------\n\nTo model CTI, **PyAutoCTI** wraps the library **arCTIc** (https://github.com/jkeger/arctic).\n\nCTI can be added to an image as follows:\n\n.. code-block:: python\n\n    import autocti as ac\n\n    \"\"\"\n    Define a pre-cti image which **PyAutoCTI** adds CTI to.\n    \"\"\"\n    pre_cti_data_2d = ac.Array2D.no_mask(\n                values=[\n            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n        ],\n        pixel_scales=0.1,\n    )\n\n    \"\"\"\n    A clocker object is used to model CCD clocking, which includes customization such\n    as the properties of the read-out electronics.\n    \"\"\"\n    clocker_2d = ac.Clocker2D(parallel_roe=ac.ROE())\n\n    \"\"\"\n    CTI is caused by traps on the CCD's silicon lattice, for example traps which capture\n    electrons instantaneously.\n    \"\"\"\n    parallel_trap = ac.TrapInstantCapture(density=100.0, release_timescale=1.0)\n\n    \"\"\"\n    CTI also depends on how electrons fill each pixel in a CCD, therefore we define\n    the volume-filling properties of the CCD.\n    \"\"\"\n    parallel_ccd = ac.CCDPhase(\n        well_fill_power=0.58, well_notch_depth=0.0, full_well_depth=200000.0\n    )\n\n    \"\"\"\n    The data, traps and CCD properties are combined to clock the pre-CTI data and return the\n    post-CTI data.\n    \"\"\"\n    post_cti_data_2d = clocker_2d.add_cti(\n        data=pre_cti_data_2d,\n        parallel_trap_list=[parallel_trap],\n        parallel_ccd=parallel_ccd\n    )\n\n    \"\"\"\n    We can use PyAutoCTI's built in visualization library to plot the data with CTI.\n    \"\"\"\n    import autocti.plot as aplt\n\n    array_2d_plotter = aplt.Array2DPlotterarray=post_cti_data_2d)\n    array_2d_plotter.figure_2d()\n\n\nWith **PyAutoCTI**, you can begin calibrating a CTI model in minutes. The example below demonstrates a simple analysis\nwhich fits a CTI model to charge injection imaging calibrate data (a form of data used to calibrate a CTI model)\n\n.. code-block:: python\n\n    import autofit as af\n    import autocti as al\n    import autocti.plot as aplt\n\n    \"\"\"\n    Define the 2D shape of the charge injection image.\n    \"\"\"\n    shape_native = (30, 30)\n\n    \"\"\"\n    Define where the charge injection is on the data.\n    \"\"\"\n    regions_list = [(0, 25, serial_prescan[3], serial_overscan[2])]\n\n    \"\"\"\n    Setup the data layout which informs **PyAutoCTI** where information on \n    CTI is in the data.\n    \"\"\"\n    layout = ac.Layout2DCI(\n        shape_2d=shape_native,\n        region_list=regions_list,\n    )\n\n    \"\"\"\n    Load the charge injection image from fits.\n    \"\"\"\n    dataset = ac.ImagingCI.from_fits(\n        data_path=path.join(dataset_path, f\"data.fits\"),\n        noise_map_path=path.join(dataset_path, f\"noise_map.fits\"),\n        pre_cti_data_path=path.join(dataset_path, f\"pre_cti_data.fits\"),\n        layout=layout,\n        pixel_scales=0.1,\n    )\n\n    \"\"\"\n    Again define the clocker which models CCD clocking and read-out electronics.\n    \"\"\"\n    clocker_2d = ac.Clocker2D(parallel_roe=ac.ROE())\n\n    \"\"\"\n    Define the traps in the CTI model and customize the priors of their free parameters.\n    \"\"\"\n    trap = af.Model(ac.TrapInstantCapture)\n    \n    trap.density = af.UniformPrior(lower_limit=0.0, upper_limit=20.0)\n    trap.release_timescale = af.UniformPrior(lower_limit=0.0, upper_limit=20.0)\n\n    \"\"\"\n    Define the CCD filling behaviour of the CTI, which is also part of the model and is\n    fitted for as free parameters.\n    \"\"\"\n    parallel_ccd = af.Model(ac.CCDPhase)\n\n    parallel_ccd.well_fill_power = af.UniformPrior(lower_limit=0.0, upper_limit=1.0)\n    parallel_ccd.well_notch_depth = 0.0\n    parallel_ccd.full_well_depth = 200000.0\n\n    \"\"\"\n    We define the non-linear search used to fit the model to the data (in this case, Dynesty).\n    \"\"\"\n    search = af.Nautilus(name=\"search[example]\", n_live=50)\n\n    \"\"\"\n    We next set up the `Analysis`, which contains the `log likelihood function` that the\n    non-linear search calls to fit the cti model to the data.\n    \"\"\"\n    analysis = ac.AnalysisImagingCI(dataset=dataset, clocker=clocker_2d)\n\n    \"\"\"\n    To perform the model-fit we pass the model and analysis to the search's fit method. This will\n    output results (e.g., dynesty samples, model parameters, visualization) to hard-disk.\n    \"\"\"\n    result = search.fit(model=model, analysis=analysis)\n\n    \"\"\"\n    The results contain information on the fit, for example the maximum likelihood\n    model from the Dynesty parameter space search.\n    \"\"\"\n    print(result.samples.max_log_likelihood())\n\nSupport\n-------\n\nSupport for installation issues, help with cti modeling and using **PyAutoCTI** is available by\n`raising an issue on the GitHub issues page <https://github.com/Jammy2211/PyAutoCTI/issues>`_.\n\nWe also offer support on the **PyAutoCTI** `Slack channel <https://pyautocti.slack.com/>`_, where we also provide the\nlatest updates on **PyAutoCTI**. Slack is invitation-only, so if you'd like to join send\nan `email <https://github.com/Jammy2211>`_ requesting an invite.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "PyAutoCTI: Charge Transfer Inefficiency Modeling",
    "version": "2024.1.27.4",
    "project_urls": {
        "Homepage": "https://github.com/jammy2211/PyAutoCTI"
    },
    "split_keywords": [
        "cli"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d3ac12e7338ae33e5505ece1e7473b751f0e6c45757a6df0fadc59b24d14135",
                "md5": "a0f6bd2b976c19a02bb6987e19ca8a4c",
                "sha256": "59cc4cc2bab9a62157749e0f792fad43919830b1861dd55e3ed396eeb0afbe0e"
            },
            "downloads": -1,
            "filename": "autocti-2024.1.27.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0f6bd2b976c19a02bb6987e19ca8a4c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 167492,
            "upload_time": "2024-01-27T19:56:49",
            "upload_time_iso_8601": "2024-01-27T19:56:49.861834Z",
            "url": "https://files.pythonhosted.org/packages/1d/3a/c12e7338ae33e5505ece1e7473b751f0e6c45757a6df0fadc59b24d14135/autocti-2024.1.27.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c0bb1e615085017f3c69c1b6d9a9c0202cea71427f9687ab5d1f3853865c24c",
                "md5": "eb47d60c1eca730e5827d32b52e0d985",
                "sha256": "c72e20194c579c502e27e13c8dca04cab2ff103b352f6a7aef3158b38d09eefc"
            },
            "downloads": -1,
            "filename": "autocti-2024.1.27.4.tar.gz",
            "has_sig": false,
            "md5_digest": "eb47d60c1eca730e5827d32b52e0d985",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 115208,
            "upload_time": "2024-01-27T19:56:55",
            "upload_time_iso_8601": "2024-01-27T19:56:55.379108Z",
            "url": "https://files.pythonhosted.org/packages/8c/0b/b1e615085017f3c69c1b6d9a9c0202cea71427f9687ab5d1f3853865c24c/autocti-2024.1.27.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-27 19:56:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jammy2211",
    "github_project": "PyAutoCTI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "autocti"
}
        
Elapsed time: 0.18033s