wildjames / calibrate_ucam_to_sdss

Calibrations can be tricky sometimes. Here's a testing ground to sort that out.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proper calibration of lightcurves.

We want to get the lightcurve of our target into SDSS band, mJy lightcurves. This is tricky, since the filters are super SDSS and we don't have proper standard stars for that yet... We've tried a couple of methods, and this seems to be the most trusted one we've used.

Install these

Required python modules (install with pip):

  • argparse
  • json, ruamel
  • pandas, numpy, scipy
  • astropy
  • pprint
  • pathlib

Required modules that are a bit more involved:

  • hipercam pipeline
  • pysynphot
  • ucam_thruput

The "problem children" are hipercam and pysynphot.

What to do

You gotta do some stuff, though. It's not too difficult though!

  1. Gather some data (OPTIONAL)

    I've pre-calculated the colour term gradients. We want to use an equation of this kind of form:

    $g_{sdss} = g_{inst} + g_{zp} - k_{ext}*\chi + a_{g}(g-r)_{sdss}$

    i.e. atmospheric correction applied, colour term accounted for. The file FOUND_VALUES.json contains a_ugr values, calculated from sythetic spectra. This is generated by the script generate_colour_term_corrections.py, and shouldn't need to be re-done. Resulting $a_X$ terms are stored in the JSON file FOUND_VALUES.json.

  2. Reductions.

    You'll need three reductions, for a run;

    • Standard star reduction - large apertures to capture all the light of the star. Don't use optimal reductions!
    • A reduction in the target field, that uses the SAME settings as the first one, that we can use to find the SDSS magnitudes of the comparison star(s) and the target.
    • The target field, with optimised reduction settings, i.e. good SNR on the target.

    When calibrating a set of runs, you must make sure that all the log files are using the EXACT same comparison stars! This script will assume they're numbered in the same order, too, so it's easiest to bear that in mind as you go.

  3. Calculate zero points

    The colour terms above are fine, but since they're calculated from surface fluxes (and synthetic...) we don't really want to use them for zero points.

    What we need to know is the apparent magnitudes of the comparison stars, and to know that we need the zero points to subtract. Fortunately, for any frame, we only need to do this once! Get a nice clear night on your target, and reduce it with wide apertures to capture all the light from the comparison. Later, it won't matter too much if you cut some off, but here it absolutely does.

    Use the script calculate_zero_points.py to extract zero points from your standard star and comparison star reductions. This updates the zero points to the FOUND_VALUES.json file, too.

  4. Calculate SDSS magnitudes for the comparison stars

    The instrumental magnitudes of the comparison stars can be converted to SDSS magnitudes now. This is done with the script calculate_comparison_magnitudes.py. Feed it all the observations you want to calibrate, but be warned - make sure they all use the same comparison stars! This script uses the FOUND_VALUES.json file, and builds a comparison_mags file.

  5. Flux calibrate the target There is a script in here called flux_calibrate_target.py, but I personally don't use it and I'd strongly recommend using whatever normal calibration workflow you have, now that you have the proper comparison star magnitudes! The flux calibrate target script here is almost certainly junk for your use-case!

About

Calibrations can be tricky sometimes. Here's a testing ground to sort that out.


Languages

Language:Python 90.8%Language:Jupyter Notebook 9.2%