Skip to content

Commit

Permalink
Merge pull request USNavalResearchLaboratory#89 from MJWeberg/main
Browse files Browse the repository at this point in the history
Update RTD config
  • Loading branch information
MJWeberg authored Mar 7, 2024
2 parents e64bd18 + 59e2ec1 commit caeab8d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
8 changes: 7 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
Expand All @@ -15,7 +21,7 @@ formats:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
version: 3.10
install:
- method: pip
path: .
Expand Down
22 changes: 12 additions & 10 deletions docs/guide/00-quick.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Example call signature,

::

read_cube('eis_20190404_131513.data.h5', 195.119)
data_cube = read_cube('eis_20190404_131513.data.h5', 195.119)

`~eispac.core.read_cube` typically requires two arguments:

Expand Down Expand Up @@ -65,15 +65,17 @@ Example call signature,

::

read_template('fe_12_195_119.2c.template.h5')
tmplt = read_template('fe_12_195_119.2c.template.h5')

`~eispac.core.read_template` is relatively simple. It takes a single argument
giving the filename of a template file and returns an `~eispac.core.EISFitTemplate`
class instance containing the the initial fit parameters. Users may view the parameter
values by using either the ``print_parinfo()`` method or manually inspecting the
``.template`` attribute. For convenience, there is also a ``central_wave`` attribute
that contains the mean wavelength value within the template. This can be useful for
loading the correct spectral window using `~eispac.core.read_cube`.
class instance containing the the initial fit parameters. You can also load custom
templates by first defining a TOML file with your template parameters (see the
:ref:`Custom Fit Templates <sec-template_toml>`: section for an example TOML
file). You may print a summary of the template and parameter contraints by typing
``print(TEMPLATE)``. For convenience, there is also a ``.central_wave`` attribute
that contains the mean wavelength value within the template. This can be useful
for loading the correct spectral window using `~eispac.core.read_cube`.

fit_spectra
-----------
Expand All @@ -82,7 +84,7 @@ This is the main fitting routine. Example call signature,

::

fit_spectra(data_cube, fit_template)
fit_results = fit_spectra(data_cube, fit_template)

The simplest way to use `~eispac.core.fit_spectra()` is to give it two arguments:

Expand All @@ -101,8 +103,8 @@ Alternatively, you may provide the function with individual data arrays like thi

::

fit_spectra(inten_arr, template_dict, parinfo=parinfo_dict,
wave=wavelength_arr, errs=error_arr)
fit_result = fit_spectra(inten_arr, template_dict, parinfo=parinfo_dict,
wave=wavelength_arr, errs=error_arr)

The function will loop over the data according to its dimensionality. 3D data is
assumed to be a full EIS raster (or a sub region), 2D data is assumed to be a
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/02-scripts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ EISPAC. If you have a working IDL installation of SolarSoft, the tool will
attempt to locate a copy of the ``eis_cat.sqlite`` database on your computer.
Otherwise, the program will try to download the database the first time you
start the GUI. Please be patient, downloading the full catalog can take a
minute of two.
minute or two.

.. figure:: figures/eis_catalog_example.png
:align: center
Expand Down
16 changes: 10 additions & 6 deletions docs/guide/04-fitting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ determining an initial guess for each parameter. The next ingredient for
a fit is the selection of an optimization method. By default, EISPAC
uses a Python implementation of the well-known IDL method **MPFIT**,
which solves the non-linear least squares problem using the Levenberg-
Marquardt algorithm. The Python module, ``mpfit.py``, can be found on
GitHub [#]_ and is included in EISPAC. Future versions of the code will
include full support for other fitting packages such as the newer
Marquardt algorithm. The Python module, ``mpfit.py``, is included in EISPAC
and the orginal source code can found on GitHub [#]_. Future versions of
of EISPAC may include support for other fitting packages such as the newer
`astropy.modeling` framework.

Template Files
Expand Down Expand Up @@ -197,7 +197,7 @@ number of parameters. Other valid template keys include,
* **n_gauss** (int) - number of Gaussian components
* **n_poly** (int) - Number of background polynomial terms.
Common values are: 0 (no background), 1 (constant), and 2 (linear).
* **line_ids** (array_like) - Strings giving the line identification
* **line_ids** (array-like) - Strings giving the line identification
for each Gaussian component. For example, "Fe XII 195.119".
If not specified, placeholder values of "unknown I {INITAL CENTROID VALUE}"
will be used.
Expand All @@ -210,14 +210,16 @@ in the ``.parinfo`` list of dicts. As such, they must be input as arrays or list
with the same number of elements as the ``value`` array.

* **fixed** (0 or 1) - If set to "1", will not fit the parameter and just use initial value instead
* **limited** (two-element array_like) - If set to "1" in the first/second
* **limited** (two-element array-like) - If set to "1" in the first/second
value, will apply and limit to the parameter on the lower/upper side
* **limits** (two-element array_like) - Values of the limits on the
* **limits** (two-element array-like) - Values of the limits on the
lower/upper side. Both "limited" and "limits" must be give together.
* **tied** (str) - String defining a fixed relationship between this
parameters one or more others. For example "p[0] / 2" would define
a parameter to ALWAYS be exactly half the value of the first parameter.

.. _sec-template_toml:

The second method for initializing a custom template is to write a separate
TOML-formatted text file with all of the input parameters and then load the
custom template file using the `~eispac.core.read_template`. This allows you to
Expand Down Expand Up @@ -366,6 +368,8 @@ of arrays.
err_int float64 (128, 32, 2)
vel float64 (128, 32, 2)
err_vel float64 (128, 32, 2)
width float64 (128, 32, 2)
err_width float64 (128, 32, 2)
params float64 (128, 32, 7)
perror float64 (128, 32, 7)
component int32 (7,)
Expand Down
4 changes: 3 additions & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ try installing the required packages individually first.

- python-dateutil >= 2.8

- tomli >= 1.1.0 (python < v3.11 only)

.. _sec-install:

Standard Installation
---------------------

EISPAC is now available on PyPI. To install, just use the following command,
EISPAC is available on PyPI. To install, use the following command,

::

Expand Down

0 comments on commit caeab8d

Please sign in to comment.