The github related to WiFeS is a bit of a mess, but here is a copy of the pyWiFeS code that you can install for observations that were taken not using the robotic system (i.e., you or another observed them yourself using TAROS): here.
If you have observations that are taken using WiFeS now that it is robotic, you will have to use an updated version of the code which can be found here. However, note that there MAY be an issue with the wavelength solution associated with the red side of the detector. As such, before you run the robotic pyWiFeS you will also need to run the following code on data first: fix_shift.py
./01_generate_metadata_script.py [directory of raw data]
- Check that it's parsed the headers correctly for the save*metadata.py files. Note, you will have to add 'flux' to the 'type' variable for the std_obs description or it won't work.
python save_red_metadata.py
python save_blue_metadata.py
./03a_reduce_red_data.py [pickle_file_generated_from_save_metadata_script] >& log.red
./03b_reduce_blue_data.py [pickle_file_generated_from_save_metadata_script] >& log.blue
In your data directory run the fix_shift.py script on raw data and calibrations. This will make a new folder in your data directory where it has updated these files.
./fix_shift.py source_dir [output_dir]"
Now that you applied this fix, you can run the pyWiFeS analysis.
./01_generate_metadata_script.py [directory of raw data]
- Check that it's parsed the headers correctly for the save*metadata.py files. Note, you may have to add 'flux' to the 'type' variable for the std_obs description or it won't work.
python save_red_metadata.py
python save_blue_metadata.py
./03a_reduce_red_data.py [pickle_file_generated_from_save_metadata_script] >& log.red
./03b_reduce_blue_data.py [pickle_file_generated_from_save_metadata_script] >& log.blue
It is important to have a good file structure before analysing the data. As such it would be ideal to have the following structure of source->date of observation->raw data, reduced_b, reduced_r:
Here:
raw_data will have all data products including calibrations [darks, wires, flats, biases], standards, science obserations
reduced_b will have the reduced files for the blue CCD after pyWiFeS has run
reduced_r will have the reduced files for the red CCD after pyWiFeS has run
When pyWiFeS is run, it will produce a number of files but the main set of files you will want to use are the datacubes which have the ending: *p11.fits. These will be in the reduced_b and reduced_r folders and there will be two files one for the blue CCD and one for the red CCD. Note that all other files within the reduced_b and reduced_r files can be deleted as they can always be re-generated again if needed.
In the pyWiFeS python scripts there are a handful of directories you will need to update so it points to your local directory.
In 01_generate_metadata_script.py you will have to update the following parts:
sys.path.append(r'/Users/kauchettl/Documents/software/pywifes_master_robotic/src/') <--This points to pywifes files necessary to run the reduction
os.environ["pywifes_dir"] = "/Users/kauchettl/Documents/software/pywifes_master_robotic/" <--This points to where pywifes is located
os.environ["metadata_dir"] = "/Users/kauchettl/Documents/software/pywifes_master_robotic/reference_data/" <--This points to pywifes files necessary to run the reduction
all_files = os.listdir("/Users/kauchettl/Documents/Obs/a14li_host/20230528/cali_fixed/") <---This points to where your raw data is or the data that has been corrected using the fix_shift.py program.
In 03a_reduce_red_data or 03b_reduce_blue_data you will need to update the following:
sys.path.append(r'/Users/kauchettl/Documents/software/pywifes_master_robotic/src/')<--This points to pywifes files necessary to run the reduction
os.environ["pywifes_dir"] = "/Users/kauchettl/Documents/software/pywifes_master_robotic/" <--This points to where pywifes is located
os.environ["metadata_dir"] = "/Users/kauchettl/Documents/software/pywifes_master_robotic/reference_data/" <--This points to pywifes files necessary to run the reduction
The above is the same as what is in 01_generate_metadata_script, while below are additional directories you will need to update:
data_dir = os.path.join(proj_dir,'/Users/kauchettl/Documents/Obs/a14li_host/20230528/cali_fixed/') <---This points to where your raw data is or the data that has been corrected using the fix_shift.py program.
out_dir = os.path.join(proj_dir,'/Users/kauchettl/Documents/Obs/a14li_host/20230528/reduced_b/') <----This points to where the reduced data files will go and you need to create this folder prior to running this script. If you are running the reduced_red_data python script, you will need to change reduced_b to reduced_r
calib_prefix = os.path.join(out_dir,'/Users/kauchettl/Documents/software/pywifes_master_robotic/reference_data/') <--This points to pywifes files necessary to run the reduction
Once you have run 01_generate_metadata_script.py, it will then produce two python files called save_red_metadata.py and save_blue_metadata.py.
It is VERY IMPORTANT TO DOUBLE CHECK THAT DATA HAS BEEN CORRECTLY PARSED or it will screw up the reduction!!
Everything is good if the python script looks like:
Here everything is the right place, there is only one standard observation and only one science observation, while we have all the calibrations in the right place.
In 03a_reduce_red_data or 03b_reduce_blue_data there is a specific part of the python code which control the reduction. Specifically:
When you run the reduced_red_data or reduced_blue_data python scripts in your terminal it will output the following either directly to the terminal or into your log file:
As the analysis run you will also come across a number of plots that look like the following which correspond to the alignments of the wires.
However the most important plots to look at are the following:
These tell you if the analysis worked well or not. If the sensitivity fit looks reasonable (i.e., like the above) and in the standard star, one can see certain sky lines or telluric lines aligning with the observed flux of the star and the reference flux then everythng should be ok. If the sensitivity curve looks terrible or there seems to be a misalignment of the lines in the standard, then you will need to run it again.
- Open the output *p11.fits datacubes in QFitsView
- Load file
- I generally use zoom=1000%, change the scaling from Single to Median, change the colourbar from Linear to Logarithmic
- For well-isolated point sources, I change the Single Pixel aperture to Circular-Annular (usually with R1=2, R2=4 for typical 2.3m seeing), centre up the cursor on the target, right-click to extract directly to FITS
- For extended sources, or when neighbours would contaminate the nearby sky aperture, select a Circular aperture of the size you want for your final extraction, pick an area in the cube that's free of source flux (I generally try to keep it in the same column as the source, if possible, to minimise the calibration differences), right click to copy the spectrum to a new buffer. Switch back to Buffer 1 (the datacube), centre up on the target and copy the source spectrum to a new buffer, then use the big minus button at the top to subtract off the sky spectrum (Buffer 2, if done in the order described), and right click to save the resulting spectrum to FITS format.
If you are classifying a supernova see here for classification programs and here for tips when classifying.
Below is a step by step:
Select #1 load for primary extenstion to load up your data.
Make your Circular-Annular (usually with R1=2, R2=4 for typical 2.3m seeing) and overlay it on your source of interest
Copy spectrum to new buffer
This is what a spectrum may look like for your source (could also have other lines or features! it depends on your source!)
Now we need to estimate the background or sky contribution so we need to find a source free area to select a spectrum like so and copy it to another buffer.
This is what the sky looks like.
Now we need to subtract the sky spectrum from the spectrum of our source so we need to go subtract buffer 3.
This is our sky subtracted spectrum which we can then save as a fits file.