plot_spec.py

Space Telescope Science Institute

Synopsis:

A simple program to plot and smooth models made with Sirocco.

Command line usage (if any):

usage: plot_spec.py [-wmin 850 -wmax 1850 -smooth 21] rootname

Description:

This is a routine to plot the detailed spectra produced with Sirocco. The rootine reads the .spec file and produces a smoothed plot for all of the angles that have been extracted.

Normally, the routine would be invoked from the command line with the rootnmae of the Sirocco run.

A plot rootname.png is produced. With none of the command line options the spectrum will comver the full spectral range of the detailed spectra, and will be box-car smmothed by 11 pixels.

There are various command line options

=h prints a help based on __docs__ -wmin sets the minimum wavelength of the plot -wmax sets the maximimy wavelength for the plot -smooth changes the binning in pixels

Primary routines:

steer Processes the command line options and then calls do_all_angles do_all_angles Produces the plot (do_all_angles(root) is the routine to call from a script

Notes:

History:

140222 ksl Coding begun 1802 ksl Modified so that it worked better from the command line, and added steering routine.

plot_spec.do_all_angles(rootname='sv', smooth=21, wmin=850, wmax=1850, fmax=0, fig_no=1, title=None)

Plot each of the spectra where

smooth is the number of bins to boxcar smooth fmax sets the ylim of the plot, assuming it is not zero

and other values should be obvious.

140907 ksl Updated to include fmax 140912 ksl Updated so uses rootname 141124 ksl Updated for new formats which use astropy

plot_spec.do_all_angles_ev(rootname='sv', smooth=21, emin=1000, emax=9000, fmax=0, fig_no=1)

Plot each of the spectra where

smooth is the number of bins to boxcar smooth fmax sets the ylim of the plot, assuming it is not zero

and other values should be obvious.

160405 ksl This version of the routine is intended to plot the X-ray

regime

plot_spec.do_mosaic(rootname='sv', smooth=21, wmin=850, wmax=1850, fmax=0, fig_no=1, title=None)

Plot each of the spectra where

smooth is the number of bins to boxcar smooth fmax sets the ylim of the plot, assuming it is not zero

and other values should be obvious.

140907 ksl Updated to include fmax 140912 ksl Updated so uses rootname 141124 ksl Updated for new formats which use astropy

plot_spec.get_column_names(filename='sv.spec')

Silly routine to read a spec file and return the column names. It’s silly because we need to figure out an easier way to return this for all files

plot_spec.read_file(filename, char='')

Read a file and split it into words, eliminating comments

char is an optional parameter used as the delimiter for splitting lines into words. Otherwise white space is assumed.

History:

110729 ksl Added optional delimiters

plot_spec.steer(argv)

Parse the command line