Skip to content

Commit

Permalink
Documentation upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
perwin committed Mar 13, 2023
1 parent c1aa8ee commit fdb57ce
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ PyImfit is a Python wrapper for [Imfit](https://github.com/perwin/imfit), a C++-
2D models to scientific images. It is specialized for fitting astronomical images of galaxies, but can in
principle be used to fit any 2D Numpy array of data.

**WARNING: This is currently a work in progress; use at your own risk!**

[Changelog](./CHANGELOG.md)

[![Build Status](https://travis-ci.org/perwin/pyimfit.svg?branch=master)](https://travis-ci.org/perwin/pyimfit)
Expand Down
13 changes: 12 additions & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Python 3, then you don't need to explicitly specify `pip3`.

### Standard Installation: macOS

A precompiled binary version ("wheel") of PyImfit for macOS can be installed from PyPI via `pip`:
A precompiled Intel (x86-64) binary version ("wheel") of PyImfit for macOS can be installed from PyPI via `pip`:

$ pip3 install pyimfit

Expand All @@ -20,6 +20,17 @@ by `pip` if they are not already present):
Astropy is also useful for reading in FITS files as numpy arrays (and is required by the
unit tests).

#### Installation on Apple Silicon (e.g., M1, M2) Macs

At present, the precompiled version of PyImfit is an x86-64 ("Intel") binary. This will not
work with arm64 (Apple Silicon, including M1 and M2 chips) versions of Python. However, you *can*
run PyImfit on an arm64-based Mac by running an x86-64 version of Python. How you do this depends
on how you prefer to install and use Python (e.g., python.org installers vs conda vs Homebrew); there
are various suggestions available online for how to do this, depending on how you prefer to install Python.

(The plan is to have a future release of PyImfit that natively supports arm64 as well as x86-64.)



### Standard Installation: Linux

Expand Down
7 changes: 4 additions & 3 deletions docs/sample_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ and then fit the model to the data:

# 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)

fit_result = imfit_fitter.fit(image_data, gain=4.725, read_noise=4.3, original_sky=130.14)
print(fit_result)

# 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,
Expand All @@ -51,7 +52,7 @@ and then fit the model to the data:
imfit_fitter2.loadData(image_data, mask=mask_image_data, gain=4.725, read_noise=4.3, original_sky=130.14)

# do the fit, using Nelder-Mead simplex (instead of default Levenberg-Marquardt) as the solver
imfit_fitter2.doFit(solver="NM")
fit_result2 = imfit_fitter2.doFit(solver="NM")


You can also programmatically construct a model within Python (rather than having
Expand Down
3 changes: 2 additions & 1 deletion new_notes_and_todo_for_python-wrapper_code.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ PLAN:

** GENERAL/FUTURE TO-DO

[ ] Update Linux libimfit.a to include count_cpu_cores.o
[ ] Add indications of n_iterations to FitResult output in case of NM or DE fits
-- currently, FitResult.nIter = -1 when they succeed


[X] Add ftol keyword to fitting.py --
Expand Down

0 comments on commit fdb57ce

Please sign in to comment.