Monday, April 2, 2012

Getting tsField files from SDSS

I'm always looking for this or that little piece of code I really wrote sometime ago but can't remember where I put it. Then I end up rewriting it because it is faster than grepping entire work directory and sorting through the offal. I wrote about batch downloading of SDSS images, now it seems I need a specific pipeline parameter from all 900 tsField files. Here's a oneliner (from a multi-line blob of code I'm now keeping at GitHub).
 
wget http://das.sdss.org/imaging/'+run+'/'+rerun+'/calibChunks/'+camcol+'/tsField-'+runstr+'-'+camcol+'-'+rerun+'-'+field_str+'.fit

After downloading (or just reading the parameter from header and moving happily along, I'm currently figuring that out)-- no downloading. I'm reading the value from header via http, as pyfits are capable of that.

3 comments:

  1. Hi,

    Could you plz let me know how to read or download the tsField file from SDSS?
    I need aa, kk and airmass valuse in all respective bands.

    ReplyDelete
  2. Hi there,
    they are ordinary fits files. The snippet I used looks like:

    tsFile = pyfits.open('http://das.sdss.org/imaging/'+run+'/'+rerun+'/calibChunks/'+camcol+'/tsField-'+runstr+'-'+camcol+'-'+rerun+'-'+field_str+'.fit', mode='readonly')

    img = tsFile[1].data
    #indexing -- field numbering in documentation starts with 0, hence #27 instead of #28 field, etc
    zpt_r = list(img.field(27))[0][filterNumber]
    ext_coeff = list(img.field(33))[0][filterNumber]
    airmass = list(img.field(22))[0][filterNumber]
    params = [zpt_r, ext_coeff, airmass]

    ReplyDelete
    Replies
    1. Thank you very much for your reply..

      I am new in this work so could you plz explain me where I should run this coding?
      I do not have pyfits in my laptop.
      I am trying through CasJobs - login - query - MyDB etc


      Regards

      Delete