Skip to content

Commit

Permalink
Merge pull request #5 from elliesch/master
Browse files Browse the repository at this point in the history
Adding Initial Images of GUI plots for Visualization Review
  • Loading branch information
kelle authored Jul 6, 2017
2 parents 15214f0 + 7d259d0 commit b69a2b0
Show file tree
Hide file tree
Showing 7 changed files with 566 additions and 1,037 deletions.
Binary file added L3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 78 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,80 @@
# UltracoolTypingKit
Home for qualitative spectral typing GUI that follows the Cruz Method
Home for qualitative spectral typing GUI that follows the Cruz Method as proposed in <Cruz et al. (2017)>.
Currently this GUI spectral types L field, L beta and L gamma brown dwarfs.
This code is written in Python 3.6, and does not yet have functionality for Python 2.

### Instructions on usage coming soon!

### Usage

This code currently requires this directory tree to run properly:

├── TypeFinder.py
├── new_types
│   └── saves selected spectral type image here
├── spectra
│   └── nir
│   ├── store nir spectra here
│   └── store full nir templates here
└── templates
   └── store Cruz 2017 band-by-band templates here

To run many spectra consecutively, the following wrapper can be helpful.
It will print out the file name and wait for the user to press enter before continuing.

```python
from TypeFinder import *
f = open("list_of_file_names.txt", "r")
lines = f.read().splitlines()

for file in range(len(lines)):
...: print(lines[file])
...: typing_kit("spectra/nir/"+lines[file])
...: input("Press Enter to continue...")

```


### 1. Running the Program
On running, this initial window will pop up:
<img src="https://raw.githubusercontent.com/elliesch/UltracoolTypingKit/master/opengrid.png" width="750">

Your input spectra will be shown in black, over the Cruz et al. (2017) J-H-K band templates shown in red.
The initial grid shows each spectral type band-by-band.


### 2. Selecting a Spectral Type
To view a specific spectral type in more detail, key in the number you would like to see while your mouse is over the grid.
To see a field object, press the corresponding spectral type number key on your keyboard.

For example, for an L3 press:
<kbd>3</kbd>


To see a beta object, press the control key and the corresponding number. (Make sure to press control first)

For example for an L1-beta press:
<kbd>ctrl</kbd> + <kbd>1</kbd>


To see a gamma object, press the alt key and the corresponding number. (Make sure to press alt first)

For example for an L2-gamma press:
<kbd>alt</kbd> + <kbd>1</kbd>

After keying in your selection, a window centered on your spectral type will pop up:
![Grid of Spectral Type Selection](https://raw.githubusercontent.com/elliesch/UltracoolTypingKit/master/L3.png)

This grid shows your selected spectral type bracketed by it's neighboring types, both band-by-band and across
the entire NIR spectrum at once in the right-hand column, following the same color scheme as the initial grid.
The templates used in for the entire NIR spectrum follow the templates specified in Cruz et al. (2017).


### 3. Saving Selected Spectral Type
Currently the code automatically saves an image of your selection into the new_types folder. We are in the process
of updating it so that you can select whether you would prefer to save or see another type.


### Citation
Copyright 2017 Ellianna Schwab and collaborators

If you make use of this code, please cite Cruz et al. (2017) and the zenodo DOI for the code, coming soon!
Binary file added Tests/test_L3.fits
Binary file not shown.
25 changes: 25 additions & 0 deletions Tests/test_typing_kit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import unittest
from TypeFinder import *

# class TestData(unittest.TestCase):
#
# def setUp(self):
# '''
# This defines data to test
# '''
# self.data = Data('test_L3.fits')
#
# def test_init(self):
# '''
# This tests that the J-H-K arrays have been sorted properly by checking their boundary conds.
# '''
#
# self.assertTrue([0.87 <= wlength <= 1.39 for wlength in self.data.wavelength_J])
# self.assertTrue([1.41 <= wlength <= 1.89 for wlength in self.data.wavelength_H])
# self.assertTrue([1.91 <= wlength <= 2.39 for wlength in self.data.wavelength_K])


### FUTURE TESTS ###
# 1. Test that the x-axis boundaries are logical on input data for J-H-K bands using get_axis
# 2. Test that pressing a letter key returns the proper error
# 3. Test that a png shows up when the correct key is pressed
Loading

0 comments on commit b69a2b0

Please sign in to comment.