Monday, February 22, 2016

uvot analysis error messages

This is just a listing I'm starting of error messages I see while doing UVOT analysis of supernovae , what the real problem was, and how to fix it.  Most (possibly all) are not issues with the software but problems with how one is trying to use the software.

uvotmaghist getting hung up -- activity monitor listing uvotinteg as taking 99% of the CPU time but not getting anywhere. 

problem -- region files contained two lines, one with the correct source position and one with some other position not in the field of view

fix -- fix the region files, rerun uvotmaghist


uvotmaghist reporting divide by zero error --

problem -- background region was not covered by the image (though it may have fallen within the zero count square made to encompass the full height and width of the image).  Especially a problem when combining full field and smaller hardware/software windows.

fix -- fix the region so it stays within the image for all the images being processed with uvotmaghist

frankenstein images where parts of a summed image seem to be wrapped around rather than just mosaiced

problem -- I think the problem was having multiple instances of uvotimsum running at the same time so the parameter file contained values from the other terminal

fix -- do them one at a time rather than multi-tasking the same command in different windows


if the galaxy count rates come out as negative, it could be that the supernova comes from a clean region and the background region happens to have a higher average count rate.  But the source region file could be bogus -- two entries for example -- confusing the standard 5" aperture that is computed for coincidence loss.


processing vv data for PSNJ09100885+5003396
# Beware of galaxy count rates > ~ 6
vv count rate is 1.65534055233002
ftcalc(4838,0x7fff7375f000) malloc: *** error for object 0x7fca3af001d0: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
^CAbort
Dumping CFITSIO error stack:
--------------------------------------------------
ffopen could not interpret primary array header of file:
PSNJ09100885+5003396_vv_phot.fits
--------------------------------------------------
CFITSIO error stack dump complete.
CFITSIO ERROR END_OF_FILE: tried to move past end of file
Task fthedit 2.00 terminating with status 107
fparkey4.3 : unable to open the FITS file PSNJ09100885+5003396_vv_phot.fits
fparkey4.3 : Error Status Returned :  107
fparkey4.3 : tried to move past end of file

fparkey4.3 :  ***** FITSIO Error Stack Dump *****
ffopen could not interpret primary array header of file:
PSNJ09100885+5003396_vv_phot.fits
Dumping CFITSIO error stack:
--------------------------------------------------
ffopen could not interpret primary array header of file:
PSNJ09100885+5003396_vv_phot.fits
--------------------------------------------------
CFITSIO error stack dump complete.
CFITSIO ERROR END_OF_FILE: tried to move past end of file
Task fthedit 2.00 terminating with status 107
Dumping CFITSIO error stack:
--------------------------------------------------
ffopen could not interpret primary array header of file:
PSNJ09100885+5003396_vv_phot.fits
--------------------------------------------------
CFITSIO error stack dump complete.
CFITSIO ERROR END_OF_FILE: tried to move past end of file
Task fthedit 2.00 terminating with status 107
Dumping CFITSIO error stack:
--------------------------------------------------

fix -- this may have been caused by the '+' in the name.  Changing the name to PSN it ran fine.

Thursday, January 28, 2016

Swift Supernova Analysis Workflow

I'm writing this mostly for some undergraduates who will help with some data reduction, but others might find the links and steps useful.

Swift supernova spreadsheet

https://docs.google.com/spreadsheets/d/1h1RB28-5BK1D-KmThlyTyvfvWO9oVJJ8-zfa22ZHXR4/

The first few columns of that spreadsheet are used to create the Swift supernova website with links added for images, data, and light curves which exist in the folder

http://people.physics.tamu.edu/pbrown/SwiftSN/swift_sn.html

The official target of opportunity list is at:
https://www.swift.psu.edu/secure/toop/summary.php

Current supernova are listed at
https://www.swift.psu.edu/secure/toop/supernovae.php

Those pages can be used to find which supernovae have been proposed and which are still being observed.  With a name or target id (the name of the supernova or host is preferred when searching as sometimes multiple target ids are used for the same target).

########   Downloading data

For recent (less than one week) data on current supernovae, you can download the data from the quicklook site.  For these quick reductions I just download the *_sk.img images into a folder /currentSwiftSNe/SNname/

>cd Desktop /SN/currentSwiftSNe/

http://swift.gsfc.nasa.gov/cgi-bin/sdc/ql?

For archived data, I download all image files from the Swift Archive checking the Swift auxiliary data and Swift uvot data boxes.  These I download into a /SwiftSNarchive/SNname/ folder

>cd Desktop /SN/SwiftSNarchive/

http://heasarc.gsfc.nasa.gov/cgi-bin/W3Browse/swift.pl

########## Processing data

My scripts look for all the gzipped data (so you can exclude data by unzipping it) so first zip it.  And at some point you might need to go into the tcsh shell

>mkdir SNname
>  cd SNname

>touch SNname_downloadcommands.txt &
>edit  SNname_downloadcommands.txt

Paste the downloaded data from the archive into the text editor and then source it

>source SNname_downloadcommands.txt

create a ds9 region file with a radius of 3 arcseconds centered on the supernova and called SNname_3.reg.  Also make a background region file named SNname_bkg.reg which has a similar background and a SNname_bkgclear.reg region clear of background stars and galaxy flux.

> gzip -f */uvot/image/*sk.img
> tcsh
> source $SNSCRIPTS/makecommands14.1.txt   <SNname>  <optional template obs id>

This generates commands to sum together the data by observation id and then append them together into one multi-extension fits file per filter plus the template images

> source SNname_allcommands.txt
> source $SNSCRIPTS/SNgalsub15.1.maghist.txt SNname

and a bunch of figures might pop up and a SNname_uvotB15.1.dat file will be created (among others).  Then I exit tcsh and make a plot with xmgrace.


> exit
> xmgrace &

I save it as a pnm file and then convert it to jpg
> convert SNname_lightcurve.pnm SNname_lightcurve.jpg

I also make a three color image

ds9 -scale log -rgb -red SNname_vv_sum.img.gz -green SNname_uu_sum.img.gz -blue SNname_m2_sum.img.gz

adjust the colors contrast and brightness.
Then save image > png >    save as SNname_uvot.png





Wednesday, November 18, 2015

Making Swift out of Science (instead of just science from Swift)

A few weeks ago for our Swift Satellite​ meeting I made some "value-added" Swift models by printing or photoshopping science papers onto the pdf model that was made by the education/public outreach group from Swift.
http://science.nasa.gov/media/medialibrary/2010/03/31/swmodguide5.pdf


These models were meant to represent the different science coming out of Swift. 



Paper models aren't easy to take safely on an airplane, so I kept them flat and began assembling them at my sister-in-law's house Saturday night before driving up to the meeting Monday morning.

 Originally I had planned on printing the models on top of the science paper.  I used a recent paper from Peter Milne showing some exciting results enabled by Swift -- the discovery of multiple classes of type Ia supernova based on their ultraviolet colors and the apparent change in the fractions of those classes with redshift.  The first one went into the printer upside down, so I used the original model to tell me where to cut and fold, but only the science paper is visible from the outside.  The hotel next to mine had a really cool looking purple light shining on its wall so I went over there to take a few pictures.





The second one I wanted to look more like Swift, so I took the pdf model and photoshopped (gimp-ed?) titles, author lists, figures, and tables from several key Swift papers onto the parts of the model.  When possible I tried to make it match -- there is a picture of someone assembling the BAT printed on the side of the BAT, the UVOT features pretty pictures, the XRT includes an image of the mirrors and an awesome X-ray echo from a bursting star.  The solar panels feature the four main instrument papers, Gehrels et al. 2004, Roming et al. 2005, Burrows et al. 2005, and Barthelmy et al. 2005.  I finished assembling this one during the conference dinner and gave it to the Swift Principle Investigator Neil Gehrels.
 I brought along the printouts for a third model but didn't know if I'd actually make it.  This one featured a paper by the conference organizer's grad student printed on top of the model.  Both were printed in black and white, which is why the picture below looks like it was taken in b&w.  Dieter Hartmann expressed enough interest in the other models I made, that I figured I should make the model I had planned to give to him anyway (being a local he wouldn't have to worry about transporting it).

Wednesday, March 4, 2015

SOUSA data use

So the Swift data is all public.  Different people request observations of different supernovae.  Sometimes multiple people request data on the same supernova.  Other people could have requested data on a particular supernova but it was already being observed.  Some of us people spend a lot of time monitoring the observations and modifying the observing plans accordingly.  Some of us were involved in getting template observations.  Others might have just pulled the public data from the archive and published it.  Sometimes there are multiple versions of the photometry independently done and published.  With my SOUSA archive, the same data might be tabulated and used by different people.  So proper credit is a tricky thing, so here are some of my thoughts.

I recommend citing any papers which originally presented Swift data on that object and where the data actually comes from (making clear whether you are using their photometry or your own reduction for example).  For the data available on my website, you should cite the Swift Optical/Ultraviolet Supernova Archive (SOUSA) paper as the source < http://adsabs.harvard.edu/abs/2014Ap%26SS.354...89B >, and the data files usually indicate if there was a previous publication.  If you make extensive use of the UVOT data and/or want advice on the analysis, it might be appropriate to involve me and add me as a coauthor.   If you are using your own reduction of the data, make sure to indicate the calibration you used (which should be the updated version of Breeveld et al. 2011) and whether they are Vega or AB magnitudes.

If using the SOUSA data, I suggest adding something like this to the observations section:

This supernova was also observed in the UV with the Ultra-Violet/Optical Telescope (UVOT; \citealp{Roming_etal_2005} on the Swift spacecraft \citep{Gehrels_etal_2004}.   The UV photometry was obtained from the Swift Optical/Ultraviolet Supernova Archive\footnote{http://swift.gsfc.nasa.gov/docs/swift/sne/swift\_sn.html} (SOUSA; \citealp{Brown_etal_2014}).  The reduction is based on that of \citet{Brown_etal_2009}, including subtraction of the host galaxy count rates and uses the revised UV zeropoints and time-dependent sensitivity from \citet{Breeveld_etal_2011}.


 and in the acknowledgements:

The work made use of Swift/UVOT data reduced by P. J. Brown and released in the Swift Optical/Ultraviolet Supernova Archive (SOUSA).   SOUSA is supported by NASA's Astrophysics Data Analysis Program through grant NNX13AF35G.

Thursday, November 20, 2014

Happy Birthday Swift !!

Ten years ago the Swift satellite was launched into space.  In honor of that anniversary I made this montage of one hundred of the supernovae Swift has observed.  Here's to ten more years !!



The picture is a mosaic of 100 supernovae and their galaxies observed by Swift.  The rendering of Swift is by NASA E/PO, Sonoma State University, Aurore Simonnet

Tuesday, October 7, 2014

SOUSA SCRIPTS

WARNING:  these instructions are a work in progress but posted here so I can get feedback from some people.  If you try them, please let me know if they work for you, where you need more instruction, etc.

As a part of the Swift Optical/Ultraviolet Supernova Archive (SOUSA) I am reducing and making public as many supernova light curves as I can.  In order to be open about my reduction methods and enable others to reduce Swift data on their own, I am posting the scripts that I use to produce light curves of SNe.  These scripts could be used to produce light curves of any other single object as well.  If you use these scripts in a publication, please cite the SOUSA paper which describes the basic method and put something in the acknowledgements.  I haven't extensively tested these scripts on other computers--I use a Macbook Pro 10.6.8 and a newer Macbook Pro.  If you have problems or questions, e-mail me or post it in the comments below.


Friday, September 19, 2014

Predicting UV brightness

Here are some plots that may help predict the ultraviolet brightness of a supernova.   They are based on the sample and figures from the Swift Optical/Ultraviolet Supernova Archive (SOUSA) paper but focusing on the mid-ultraviolet uvm2 filter.  The top plot shows the absolute magnitudes as a function of epoch for a prototype of most SN classes as observed with Swift/UVOT.  The right axis shows the redshift limit corresponding to a magnitude of uvm2=20 (a reasonable limit).  This could be useful for estimating the redshift range for particular supernova classes for Swift proposals or evaluating the observability of new supernovae now or at later epochs.  The bottom plot shows the uvm2-v colors to allow one to estimate the uvm2 magnitude based on a current or predicted optical magnitude, the type and phase.  If you use these plots, please cite the SOUSA paper they are based on.