BU-hammerTeam / PyHammer

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

How to set 'lineOutfile' to write calculated spectral indices? #28

Closed JosephKarpinski closed 6 years ago

JosephKarpinski commented 6 years ago

PyHammer Help does not list an option for 'lineOutfile':

#if the user wants the calculated spectral indices, write them to a file
            if options['lineOutfile'] is not None:
                if i == 0: 
                    lineOutfile = open('spectralIndices.csv', 'w')
                    lineOutfile.write('#Filename, CaK, CaK_var, Cadel, Cadel_var, CaI4217, CaI4217_var, Gband, Gband_var, Hgam, Hgam_var, FeI4383, FeI4383_var, FeI4404, FeI4404_var, Hbeta, Hbeta_var, MgI, MgI_var, NaD, NaD_var, CaI6162, CaI6162_var, Halpha, Halpha_var, CaH2, CaH2_var, CaH3, CaH3_var, TiO5, TiO5_var, VO7434, VO7434_var, VO7445, VO7445_var, VO-B, VO-B_var, VO7912, VO7912_var, Rb-B, Rb-B_var, NaI, NaI_var, TiO8, TiO8_var, TiO8440, TiO8440_var, Cs-A, Cs-A_var, CaII8498, CaII8498_var, CrH-A, CrH-A_var, CaII8662, CaII8662_var, FeI8689, FeI8689_var, FeH, FeH_var\n')
Welcome to the PyHammer, a tool for spectral classification.

Options:
-c, --cmd           Flag to choose to run on the command line.
-e, --eyecheck      Flag indicating pyhammer should skip classifying
                    and go straight to checking the spectra by eye.
-f, --full          Flag indicating the full path to the spectra is
                    provided in the input file list.
-g, --gui           Flag to choose to run using the gui.
-i, --infile        The full path to the input file or the name, if it
                    is in the pyhammer folder. If nothing is
                    provided, it will be asked for later.
-o, --outfile       The full path to the output file or a filename
                    which outputs to the pyhammer folder. If nothing is
                    provided, the default pyhammerResults.csv will be
                    created in the pyhammer folder.
-p, --path          The full path to the spectra. This is only necessary
                    if the input file list does not prepend the path to
                    the spectra filenames.
-r, --rejectfile    The full path to the file where reject spectra will
                    be listed or a filename which outputs to the
                    pyhammer folder . If nothing is provided, the
                    default rejectSpectra.csv will be created in the
                    pyhammer folder.
-s, --sncut         The S/N necessary before a spectra will be classified.
                    A signal to noise of ~3-5 per pixel is recommended.

Example:
python pyhammer.py -g -f -s 3 -i C:/Path/To/File/inputFile.txt -o C:/Path/To/File/outputFile.csv -r C:/Path/To/File/rejectFile.csv
JosephKarpinski commented 6 years ago

Temporary workaround is to modify code in the PyHammer Entry Point main
and change the default 'lineOutfile' value from 'None' to 'True'.

See attachment: lineoutfile_workaround

zephyr5050 commented 6 years ago

Added options to command line inputs, command line processing, and GUI to effect this option. Additions are on developer branch in commit 813bcff.

Try it out and let me know what you think.