Skip to content

2: Initial fitting of the spectra with ScousePy

jdhenshaw edited this page Jul 19, 2022 · 3 revisions

Initial fitting of the spectra with ScousePy


Once you have your GitHub repos set up, the next step of the process is to begin fitting the data. The following outlines the steps you will need to take in order to start fitting and each will be described in more detail below:

  • Get the data
  • Assign yourself a chunk to fit via the issue page
  • Create a working branch
  • Run fitting to completion
  • Commit changes and push branch to forked repo
  • Create a PR
  • Update the issue with notes and comments

Get the data

To ensure that the GitHub repo is not too heavy, the fits files are omitted by design. To begin fitting you will need two files:

  1. HC3N_TP_7m_12m_feather.fits
  2. HC3N_TP_7m_12m_feather.mask2d.fits

Both of these can be downloaded from Globus. If you do not have access yet, ping Adam Ginsburg for an account.

Assign yourself a chunk to fit via the issue page

Each chunk has an assigned issue on the issue page. You will need to assign yourself to one or more of these so that we do not duplicate effort.

Create a working branch

Once you have assigned yourself a chunk, first of all create a branch in your forked repository using

git checkout -b s1.[chunkID].scousepy

This will transfer you from the main branch on your fork to a working branch.

Run fitting to completion

To run the fitting the first thing you will need to do is update the run_scouse_chunks.py script. Namely you will need to update the following lines

s1file='s1.[chunkID].scousepy' # You will need to update these accordingly!!
s2file='s2.[chunkID].scousepy' # You will need to update these accordingly!!

Where the chunkID is the corresponding chunk that you have assigned yourself.

Running run_scouse_chunks.py will then first of all load the chunk information produced during stage 1 (see page 0 of this wiki) and then open up ScousePy's fitter. Note that the keyword refit=False should be set. During the next stage of the process, we will toggle this to True when we are checking each others fitting, but for now this should be set to False.

Next, run the fitting through to completion. Do note that setting the correct backend here is important. If the fitter interactivity is not working, the likelihood is that you have the wrong backend setup. You can find out how to change this globally here. You will need to set this to qt5agg. The alternative is to change this in the script using

import matplotlib as mpl
mpl.use('qt5agg')

I have recently updated ScousePy's source code to actually have this built in, so you can simply update your ScousePy distribution and reinstall and it should work.

Commit changes and push branch to forked repo

Once the fitting has completed you need to commit your changes. This can be done using...

git add -A
git commit -v -m "[commit statement"]
git push origin s1.[chunkID].scousepy

In the commit statement, be sure to tag the relevant issue number using e.g. #1 and include a useful statement like "Fitting complete #1".

This process will push the branch to your forked repo.

Create a PR

The next job is to create a pull request. If you head to your forked repo on the GitHub page, this should be obvious. In doing so, please add in the comments a tag to the issue just for completeness, though they should be tagged automatically if you included the tag in your commit statement.

Update the issue with notes and comments

At this point the process is complete. However, please do add any helpful comments for the reviewer who will come in at the next stage. For example, in the issue comments you can include screen grabs of bad spectra/fits plus any issues you encountered during the fitting. For example bad baselines, poor noise estimation etc.