Getting Started¶
Note regarding Jupyter Notebooks¶
I highly recommend using iPython, not Jupyter¶
Note
A part of the code has changed, so this advice may not even apply anymore… but be aware there have previously been issues.
Displaying and updating the images was unreliable in Jupyter notebooks – it sometimes worked and sometimes didn’t depending on versions. (suspect maybe something to do with interaction with javascript).
The images are refreshed/redrawn, so the ability to update a drawn figure is necessary. If you are still attempting to use a jupyter notebook and notice the figures are not behaving as you would expect, then please try with iPython.
Running threadcount¶
If you are simply running the program, most of your work and editing will only be to the runner file. You can find an example of a runner file in
ex1.py This example simply opens a cube and deredshifts it.
ex2.py This example fits multi-component lines only,
and does not analysis.
ex3_full.py This example runs the fitting code,
and analyzes the extraplaner gas of an edge-on outflow. Note it assumes the major
axis is perpendicular to the image. We will add an update to generalise this in
the future. Also note that in the current ex3_full.py example does not run the
interactive redshift correction, because it has already been run.
ex3.py This example runs the analysis code of the
above example, assuming existing output files from the fitting code. Ensure the
input filename is correct, it will be the output from a script like ex2.py, so
double-check the prefix inside the settings for this script, that it matches
a file that already exists.
Masking regions in outflow analysis¶
See mask_region_arguments for an example of how the input setting should look.
Procedures¶
There are a few “procedures” included in threadcount. These are recipes for common tasks, with easily configurable settings (i.e. the “runner” files containing the settings).
The Procedures listed below will explain and demonstrate the functions that currently exists. The first time a user runs threadcount on a galaxy they will use at least 3 Procedures: deredshifting, fitting emisison lines and analysis. Note that you only need to run the redshuft correction once for a particular source. Different applications of the fitting will use different analysis scripts. As new analysis codes are written they will be added to the Procedures.
On a 16 core computer, threadcount takes roughly 20 minutes to carry out the fits of one spectral line (using the 3 model setting) on a single KCWI field. Saving the plots takes a considerably large amount of time as well.
Models for use with lmfit¶
The Classes in the threadcount.models module gives a list of pre-defined
lmfit Models this package makes available for use. These are used just as
the built-in fitting models from lmfit would be used, and I have implemented a
guess method for most (if not all) of them.
Line objects¶
The Variables in the threadcount.lines module shows the predefined
wavelengths and Line instances. The variables beginning with “L_” are the Line
objects used in the settings for the fit_lines procedure. See threadcount.lines.Line
for an example to define your own.
Extensions to mpdaf and lmfit¶
The most notable extension here is the lmfit() method
added to the Spectrum class.
The most notable extensions for lmfit are the ModelResult class: