Skip to main content

Python Component Fitting Tool (pycfit)

Python program to replicate many spectral fitting functions of the CFIT system from SolarSoft IDL.

Installation

pip install pycfit

🛠 Important: MacOS 26 (Tahoe)

If running under MacOS Tahoe - pycfit must be run from within an ipython session using the gui qt magic command for the GUI components to work properly.

E.G.

Start ipython with the qt gui magic in place:

$> ipython --gui=qt

or, from within an ipython session:

In [1]: %gui qt

Use

Use interactive fitter to find an initial model based on an averaged spectra

import pycfit

# Retrieve sample data
wavelength, intensity, uncertainty = pycfit.data.get_example_single_spectrum()

# Call the GUI fitter
model = pycfit.cfit_gui(wavelength, intensity, uncertainty=uncertainty)

If you export your model from within the GUI, you can initialize a new pyCFIT instance with it later

from pathlib import Path

fname = Path('path/to/saved/model.py')
model = pycfit.cfit_gui(wavelength, intensity, uncertainty=uncertainty, function=fname)

Use the interactive viewer to fit each point of the raster to the initial model and adjust or mask individual point fittings as needed

# Retrieve a small-patch of sample data
wavelength, intensity, uncertainty, mask = pycfit.data.get_example_grid_spectra()

# Create a Grid fitter, using the previously defined model
myGrid = pycfit.cfit_grid(model, wavelength, intensity, 
                uncertainty=uncertainty, mask=mask)

# Fit the whole raster
myGrid.fit(maxiter=100) # Astropy fitter keywords like "maxiter" can be passed through

# Inspect and modify the fits at each point
print(myGrid.shape)
myGrid = pycfit.cfit_grid_gui(myGrid)

# Get results
results = myGrid.get_results()

Contacts:

Software Maintenance:

Ayris Narock: ayris.a.narock@nasa.gov

NASA Official:

Therese Kucera: therese.a.kucera@nasa.gov

License

This project is Copyright (c) National Aeronautics and Space Administration and licensed under the terms of the Apache Software License 2.0 license. This package is based upon the Openastronomy packaging guide <https://github.com/OpenAstronomy/packaging-guide>_ which is licensed under the BSD 3-clause licence. See the licenses folder for more information.

Metadata

Release files for pycfit 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycfit 1.1.1
File Size Uploaded Provenance Actions
pycfit-1.1.1.tar.gz 1.9 MB Without provenance Details for pycfit-1.1.1.tar.gz

Release files / pycfit-1.1.1.tar.gz

Download URL pycfit-1.1.1.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
569f77ab3de7d25e6505ccfa8e07fdb6c9ec790e6eb93802c78d5b3ca43d357d
BLAKE2b-256 checksum
How to use checksums
a7cc94f935f031b20751e215ec153e2857ae89c56be84ff870b35ef768d1a9e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for pycfit 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page