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.0

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.0
File Size Uploaded
pycfit-1.1.0.tar.gz 1.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycfit 1.1.0
File Interpreter ABI Platform
pycfit-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.9 MB

Release files / pycfit-1.1.0.tar.gz

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

Release files / pycfit-1.1.0-py3-none-any.whl

Download URL pycfit-1.1.0-py3-none-any.whl
Size 2.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dbb99130f12440c9ff9c493ca069a35ce1dad21e14fec180fb8c496255d6c393
BLAKE2b-256 checksum
How to use checksums
eb6725ff1a0738b21ee0c4c36459e9d465a6090b6bb93d57c363924ef39b6ab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

1 release file

1.0.0

1 release file

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.0

1 release file

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