Python wrapper for astronomical image-fitting program Imfit
Project description
Pyimfit
This is a Python wrapper around the astronomical image-fitting program Imfit.
Online documentation: https://pyimfit.readthedocs.io/en/latest/.
Sample Usage
The following assumes an interactive Python session (such as an iPython session or Jupyter notebook):
from astropy.io import fits
import pyimfit
imageFile = "<path-to-FITS-file-directory>/ic3478rss_256.fits"
imfitConfigFile = "<path-to-config-file-directory>/config_exponential_ic3478_256.dat"
# read in image data, convert to proper double-precisions, little-endian format
image_data = pyimfit.FixImage(fits.getdata(imageFile))
# construct model from config file; construct new Imfit fitter based on model,;
model_desc = pyimfit.ModelDescription.load(configFile)
# create an Imfit object, using the previously loaded model configuration
imfit_fitter = pyimfit.Imfit(model_desc)
# load the image data and image characteristics and do a standard fit
# (using default chi^2 statistics and Levenberg-Marquardt solver)
imfit_fitter.fit(image_data, gain=4.725, read_noise=4.3, original_sky=130.14)
# check the fit and print the resulting best-fit parameter values
if imfit_fitter.fitConverged is True:
print("Fit converged: chi^2 = {0}, reduced chi^2 = {1}".format(imfit_fitter.fitStatistic,
imfit_fitter.reducedFitStatistic))
bestfit_params = imfit_fitter.getRawParameters()
print("Best-fit parameter values:", bestfit_params)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyimfit-0.7.6.tar.gz
(622.6 kB
view hashes)
Built Distributions
Close
Hashes for pyimfit-0.7.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 040746ed1dee902221e642cba741584e94b20a17b262278a51bfb3ee830d9c14 |
|
MD5 | 6b16c1f4d6b2f0dad563e8e96e1cc66a |
|
BLAKE2b-256 | c75600d62c87c5b9fd463cf6516a1a5c0273a5d8bc60619c7923a3d33a761d39 |
Close
Hashes for pyimfit-0.7.6-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0a08138b9b466ed0dc959ff93a03781bc38f85ea3e798993f1c91a0d8c66382 |
|
MD5 | b3dea5a3c2fd40130acfd7a518dd6e5c |
|
BLAKE2b-256 | 91c91e453fb4a4fa1e0c53366c1e123c6d7570c82bfdb3edde77bdcd3cdccdcf |