Monday, August 26, 2019

Exciting Discovery or Data Problem?

So my preliminary photometry of SN2012G had a first data point which was intriguingly high.  One (or maybe two) high point in each filter for iPTF14atg was claimed to be the long-sought signature of a type Ia supernova impacting its companion in a paper published in Nature (Cao et al. 2015).  So an early high point in SN2012G could be another example.  Or it could be a problem with the data.

We recently (and finally!) obtained the host galaxy template for SN2012G in an effort to do the final photometry for SOUSA to complete our Ia sample.  So I redid the analysis and looked more closely at the images.  Indeed the first image has a readout streak from a bright star which goes right through the supernova location.  So no Nature paper for SN2012G.  But the corrected photometry will be posted soon to SOUSA.

Friday, September 21, 2018

Swift UVOT Grism Tools

While I have focused mainly on Swift UVOT photometry, UVOT also has a UV and an optical grism with which to obtain spectroscopy.

For supernovae, the spectra extraction is more complicated than long slit spectrum extraction because the dispersed spectra often go across the host galaxy and their can be other sources or spectra which overlap.
For most of the mission, the UVOT grisms were only calibrated for a certain part of the detector, so we usually did what was called a "slew in place".  This involves targeting the object and then immediately retargeting the object with the grism so that the target was in the right place.  This can only be done in the planned timeline so there was usually a couple of days delay to schedule it.  Paul Kuin's new grism calibration is valid over a larger area, so grism observations no longer require a slew-in-place in a planned schedule.  So they can be done as a rapid ToO upload.  Since we did the slew-in-place procedure for so many years (and still do it for grism observations put into the plan) you should probably make it clear when you submit the ToO request that you want the grism observations as soon as possible and don't need a slew-in-place.  But for observations scheduled into the plan, a slew in place is probably best.

Here is some of the grism documentation:
There is an IDL program called simgrism by Wayne Landsman which allows you to see how a given roll angle will affect the location of the spectrum and how it might overlap.  It shows you what a particular roll angle will look like as far as contamination goes, but you have to know which roll angles are observable anyway.  There is a range of about 20 degrees available on any given date.

As far as contamination goes, my grad student Mike Smitka has developed a method to do something similar to galaxy subtraction with the grism images.  It isn't a direct subtraction, but uses the template image for the background so it can estimate the non-linear corrections. He describes the method in this paper:

Paul Kuin implemented it into the grism reduction software as reading the background from the template image rather than an actual subtraction.  But it requires template images taken an integer number of years after the original observation (so that the roll angle is available again).  Mike obtained template images for a sample of Ia grism spectra.
Yen-Chen Pan and Ryan Foley have also modified the background subtraction to do better than the default extraction.

There is now an online tool for finding out what roll angles are available for a given ra, dec, and observation date.  You can use this with the idl program to pick roll angles which avoid bright stars in the dispersed spectrum.

Other documentation:

Thursday, June 14, 2018

Hundreds of Swift Supernovae

For a conference in Stockholm I made this excessive plot to show off the amount of Swift data we have.  The legend gives a complete (I think) list of the over 600 supernovae we've observed with Swift.  Plotted are the uvm2 absolute magnitudes and uvm2-v colors of all the supernova data I had on my laptop, accounting for about half of all the supernovae.  That means there is still some more data reduction to be done, but also a huge sample of supernova data to be doing science with.

Monday, August 8, 2016

Interpreting Flux from Broadband Photometry

Many of the techniques used on optical data to convert broadband photometry to flux, including creating spectral energy distributions and integrating the pseudobolometric flux, don't work very well in the ultraviolet.  After struggling with these issues for years, I wrote the following paper to demonstrate the difficulties and quantify the effects.  It is now on astro-ph and published in the Astronomical Journal.

The figures in the paper were designed to compare effects with a consistent wavelength range within the confines of a two column article.  So many of the figures are tall and hard to read if you are reading or projecting the paper onto a typical wide screen (like for many astro-ph/astrocoffee style discussions).  I have created a pdf with most of the figures reproduced as single panels.  That version is here. 

Comments are welcome.

Wednesday, May 25, 2016

Swift Target of Opportunity Priorities (urgency)

The stated meanings of the Swift Target of Opportunity (ToO) priorities are listed below.  For new supernovae I recommend a "High Urgency" ToO.  During the day it will sometimes be executed within a few hours as an uploaded target directly to the spacecraft.  At the latest it will be discussed the next morning--if you submit it after hours it is visible to the Swift team but does not actively page them until the next morning.  If the SN is older, a medium or low urgency request would be more appropriate.  This includes requests for continued campaigns on Swift SNe which can be planned and rerequested several days before the already requested exposures are completed so that the campaign goes on continuously but without requiring immediate action by the Swift team or bumping out previously planned targets.  The normal planning schedule is also copied from the Swift ToO page below.

A "Highest Urgency" ToO might be appropriate for a very nearby, very young supernova.  SN2011fe, with a very recent upper limit, would certainly qualify.  If a SN is discovered one night and confirmed the next night, it is probably is fine to do it as a high urgency.

From the Swift Target of Opportunity request page:

####################  (previous version used yellow highlighting which was awful to read)

Response Priorities:

    A "Highest Urgency" ToO will immediately page the Swift PI and Science Operations team, even in the middle of the night.
    "High Urgency" ToO requests will page the PI and Science Operations team immediately during working hours.
    "Medium Urgency" requests will be handled during daylight hours.
    "Low Urgency" requests will be handled at the daily planning meeting which is 9-10am Eastern Time (USA) M-F.

Please avoid using the Highest Urgency unless absolutely essential, for example

    Galactic or local-group supernova
    High-probability gravitational wave event
    High-probability neutrino event
    Highly exceptional GRB or SGR

Normal Planning Timeline: Below is the typical schedule for producing and submitting the observing schedules. Please give a few extra days for submitting ToOs around the holidays.

Day of the Week
Submit the Schedule for*
Create the Schedule for
Friday & Saturday
Friday & Saturday
Sunday & Monday
Sunday & Monday
All times are in Eastern Time (USA).
*Schedules are submitted in the mornings.

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
Dumping CFITSIO error stack:
ffopen could not interpret primary array header of file:
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:
Dumping CFITSIO error stack:
ffopen could not interpret primary array header of file:
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:
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

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

The official target of opportunity list is at:

Current supernova are listed at

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/

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/

########## 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