diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3b5671a2..bcf7cca6 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -2,4 +2,4 @@ PyAutoLabs uses one Code of Conduct across all of its repositories. -Read the [canonical PyAutoLabs Code of Conduct](https://github.com/PyAutoLabs/PyAutoScientist/blob/main/CODE_OF_CONDUCT.md). +Read the [canonical PyAutoLabs Code of Conduct](https://github.com/PyAutoLabs/.github/blob/main/CODE_OF_CONDUCT.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7df3e4d..d289b9c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ PyAutoLabs maintains its shared contribution guidance in one place. -Read the [canonical PyAutoLabs contribution guide](https://github.com/PyAutoLabs/PyAutoScientist/blob/main/CONTRIBUTING.md). +Read the [canonical PyAutoLabs contribution guide](https://github.com/PyAutoLabs/.github/blob/main/CONTRIBUTING.md). Repository-specific setup, test commands, and editing rules are documented in that repository's `README.md` and `AGENTS.md`, where present. diff --git a/README.rst b/README.rst index ff3b66eb..354665fc 100644 --- a/README.rst +++ b/README.rst @@ -1,217 +1,58 @@ -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/PyAutoLabs/PyAutoHands/actions/workflows/release.yml/badge.svg - :target: https://github.com/PyAutoLabs/PyAutoHands/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 `_ | -`readthedocs `_ | -`What is CTI? `_ - -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 `_, which includes `an installation guide `_ and an overview of **PyAutoCTI**'s core features. - -- `The autocti_workspace GitHub repository `_, 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 `_. - -We also offer support on the **PyAutoCTI** `Slack channel `_, where we also provide the -latest updates on **PyAutoCTI**. Slack is invitation-only, so if you'd like to join send -an `email `_ requesting an invite. +PyAutoCTI: Charge Transfer Inefficiency Modeling +================================================ + +.. image:: https://raw.githubusercontent.com/PyAutoLabs/PyAutoCTI/main/docs/overview/images/what_is_cti.png + :width: 600 + :alt: Charge transfer inefficiency in Hubble imaging + +**PyAutoCTI** lets you simulate, calibrate and correct charge transfer inefficiency (CTI) in CCD detectors. CTI occurs when defects in the detector trap and release electrons during readout, leaving trails in the image. + +Getting Started +--------------- + +Explore It Yourself +~~~~~~~~~~~~~~~~~~~ + +- `What is CTI? `_ — learn about CTI and how it affects your data. +- `Install PyAutoCTI `_ — get set up on your computer. +- `Find examples `_ — explore simulation, calibration and correction in the workspace. + +Explore with AI +~~~~~~~~~~~~~~~ + +The `PyAutoCTI AI Assistant `_ helps you learn about CTI and work through calibration examples through conversation. To get started, paste this prompt into your AI coding agent: + +.. code-block:: text + + I want to learn about CTI and use PyAutoCTI + (https://github.com/PyAutoLabs/PyAutoCTI) with the + autocti_assistant (https://github.com/PyAutoLabs/autocti_assistant). + + First clone the assistant repository, cd into it and follow its AGENTS.md. + Explain CTI, then guide me through the introductory calibration demonstration. + +See `AI Options `_ for tools and setup guidance. + +Learn About CTI +--------------- + +The `overview examples `_ introduce parallel and serial charge transfer, charge injection data, and how to fit and calibrate a CTI model. + +The `PyAutoCTI documentation `_ covers the software’s features and how to use them in your own analysis. PyAutoCTI uses `arCTIc `_ to simulate charge transfer through the detector. + +Community and Contributing +-------------------------- + +Ask questions, suggest improvements and share your work in `PyAutoLabs Discussions `_. + +To contribute, see the `contribution guide `_. + +Citations +--------- + +If you use PyAutoCTI in your research, see the `citation guide `_. + +License +------- + +See the `license `_. diff --git a/eden.ini b/eden.ini deleted file mode 100644 index 368764b6..00000000 --- a/eden.ini +++ /dev/null @@ -1,3 +0,0 @@ -[eden] -name=autocti -prefix=ac diff --git a/profiling b/profiling deleted file mode 100644 index f41d1ecb..00000000 --- a/profiling +++ /dev/null @@ -1,33 +0,0 @@ - fom = fit.figure_of_merit - - fit_time = time.time() - start - - if instance.cti.parallel_trap_list is not None: - - print("PARALLEL:") - - for parallel_trap in instance.cti.parallel_trap_list: - - print(f"Density: {parallel_trap.density}") - print(f"Timescale: {parallel_trap.release_timescale}") - - print(f"Beta: {instance.cti.parallel_ccd.well_fill_power}") - - - if instance.cti.serial_trap_list is not None: - - print("SERIAL:") - - for serial_trap in instance.cti.serial_trap_list: - - print(f"Density: {serial_trap.density}") - print(f"Timescale: {serial_trap.release_timescale}") - - print(f"Beta: {instance.cti.serial_ccd.well_fill_power}") - - - print(f"LH: {fom}") - print(f"Fit Time: {fit_time}") - print() - - return fom \ No newline at end of file diff --git a/to_do_list b/to_do_list deleted file mode 100644 index 18c7f9bd..00000000 --- a/to_do_list +++ /dev/null @@ -1,64 +0,0 @@ -__Workspace__ - -- Copy from Bayesian description stuff from HowToFit. - - -__Bugs__ - -- ImagingCI should not _need_ pre_cti_data (or have bool to turn off the need) because of pre_cti image estimate. - - -__Paper__ - -- readthedocs. -- introduction notebook. - - -__Visualization__ - -- Always use square axis liimits even if extracted data is rectangular. - - -__TimeEvolution Mock Data Product__ - - - Refresh brain on how this works with DataModel. - - Write a mock data product (e.g. .json files?) using this format. - - Write VIS_CTI program of function which interpolates CTI model. - - -__Time Evolution CTI__ - -- Write simple example, simulate and fit 10 CI datasets with linear time evolution, recover time evolution. -- Extend example based on Richard's HST experience. -- All of the above fit every dataset one-by-one, and perform the estimate of the time evolution model afterwards. -- Scope out implementation in Euclid framework. - -- Extend to graphical model for PyAutoFit paper (and maybe Euclid). -- Estimate performance of the one-by-one fits. -- Compare to fits which fit all datasets simultaneously, allowing for variable density in every dataset but fixed -release time. -- Compare to fits which parameterize the variable density as a linear relation across the datasets. -- Implement this linear relation fit in the graphical modeling framework, so we can fit each dataset one-by-one. NOTE: -this will use a "global" release time parameter. - - -__Validation & Verification__ - - - Discuss plan with Richard. - - Simple simulation of science data (flat?) using correction/ - - -__DataModel__ - - - Finalize that outputs of calibration run suit Kevin. - - Set up XML interface with Kevin. - - -__Flat Fields__ - - - Implement closely following CI. - - -__Cosmic Ray Flagging__ - - - Extend test suite for more realistic data (Non uniform CI, trails). \ No newline at end of file