BU-hammerTeam / PyHammer

A Python Spectral Typing Suite
MIT License
53 stars 14 forks source link

Classifying O-stars with H- and K-band spectra #12

Closed JPoorta closed 7 years ago

JPoorta commented 7 years ago

Hi all,

Looking for a program to do spectral classification of O- and B-stars (and not having access to IDL) we were delighted to come across PyHammer. It does exactly what we were about to start implementing ourselves, however, the spectra we have are in the H- and K-band (17000-26000 Angstrom).

We have template spectra available and getting them in the right format is straightforward. But there are a few things we have to adjust before running the code on our stars.

Many many thanks,

Hanneke Poorta & Maria Ramirez Tannus Anton Pannekoek Institute for Astronomy, University of Amsterdam

mveyette commented 7 years ago

I can answer some of these questions. The tempLines.pickle file contains the the spectral indices measured from every single spectrum that goes in to making the templates. Calculating all those indices is computationally intensive, so we just did it once and read it in at startup. These indices are only used for the automatic spectral typing and metallicity estimates. Since we don't use any indices in H or K, the automatic spectral typing won't work for you anyway. But, you should still be able to use the by-eye GUI feature with some tweaking. Maybe someone else could chime in with more info about what that would require.

zephyr5050 commented 7 years ago

As mveyette indicated, adapting PyHammer to auto-classify in the H and K bands will involve defining your own spectral indices to classify by. This will be somewhat involved. If you're just interested in using the eyecheck feature, I can point you to the appropriate changes you'll need to make.

  1. The Eyecheck class in the eyecheck.py file is the one which handles displaying your spectra on top of the templates. It requires, as input, the options dict which contains the location of both the user input file and the output file created during the auto-classifying part. It uses the results of the auto-classification process recorded in the output file to select the appropriate template to initially display with each spectra. You can't get this file without running the auto-classification process (which in turn requires a tempLines.pickle file for your particular wavelength range), but if you're only interested in classifying by eye, you can trick out Eyecheck by making your own output file and filling it with default values for the auto-classification results. I'd suggest running the example test case to see the format of the output file.

  2. In the updatePlot function of the Eyecheck class, on line 395 we set the plot x axis limits to wavelength values which match our range. You will of course need to change these axis limits to better fit your range.

That should be it to get the eyecheck process to work on your templates in your wavelength range.

Were you interested in adjusting the auto-classification scheme to work for your purposes as well?

JPoorta commented 7 years ago

Thanks a lot!

With a few more tweaks (not interpolating onto the grid and adjusting the normalization), we are now able to use Eyecheck with our spectra and templates.

Yes, it would be great if we could take this further and adjust the auto-classification scheme as well. Since there are not many template spectra available in H and K we will also be working on collecting a suitable atlas.

aurorayk commented 7 years ago

If you are interested in using the automatic guessing, you should be able to implement that by coming up with a list of absorption features that are good at spectrally classifying your O and B spectra. You can then add this list of features to the index dictionary (indexDict) in the defineCalcTools function in the spectrum class. Next you can run the measureLines function on your templates with the updated indexDict and save the resulting spectral indices for each template in the .pickle file. This is the basic procedure for how we created the .pickle file. There are some catches in the measureLines function that might break the code initially since we were using optical wavelengths.

If you are interested in the radial velocity function you will also need to update the wavelength coverage there.

We are happy to continue to provide advice since we want to code to be accessible to as many users as possible!