Skip to main content

Component Fitting package

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycfit-1.0.2.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycfit-1.0.2-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

File details

Details for the file pycfit-1.0.2.tar.gz.

File metadata

  • Download URL: pycfit-1.0.2.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for pycfit-1.0.2.tar.gz
Algorithm Hash digest
SHA256 435122286de070b1ead684c4067ed93dcd62629d93f8cfaf5c0a5cefbc97493f
MD5 c194a3e55104093a2ff3befab5c222b9
BLAKE2b-256 5c44bbd68c3443b387d3c50338d4d1b03e62e41c0b4c8f1f228b00374b2a00e5

See more details on using hashes here.

File details

Details for the file pycfit-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pycfit-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for pycfit-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0b4bc9873486e9cfa6b30ffb7c0c45f81bcf3659cf17d1c2679c92e55fcc7e5a
MD5 fd97a4500c68d0100fc29ad9dea4279f
BLAKE2b-256 9556d801944b7bab17c701496394ad2828f795a0ddc24bd16bce6afb737db97b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page