tomr-stargazer / wuvars-proto

A set of software tools for the "WUVARS" (WFCAM-UKIRT Variability Study) project. Preliminary code (not ready for distribution).
2 stars 0 forks source link

Refactor plot3.py for portability between datasets #9

Open tomr-stargazer opened 11 years ago

tomr-stargazer commented 11 years ago

A good idea for this project, so that it can be ported over multiple UKIRT WFCAM time-series datasets:

Have a "generic" lightcurve-plotting package that is configured for WFCAM JHK data but is agnostic to start-date of observations, "abridges" in the data, etc, but accepts such things as optional keyword parameters. It will have, largely, the same configuration parameters as currently. Call it lightcurve_plot or wfcam_plot or wuvars_plot.

Then have a module for each project that "configures" the wuvars_plot options for each set of observations and call them "cygob7_plot" and "onc_plot". In each one, define functions (like "graded_lc") with the same name as their wuvars_plot counterparts, but with the appropriate parameters passed in, hardcoded into cygob7_plot and its siblings. Ideally, this would also allow season-handling as customizable between datasets, with each project having its own "season_cut" (or having a generic season_cut that takes in the start/end dates of each season as args).

Example:

""" cygob7_plot.py: Extends wuvars_plot commands for Cyg OB7. """

import wuvars_plot

def lc(table, sid, season=0, outfile='', name='', stetson=True, png_too=False, 
      color_slope=False, plot_warn=True):
    """ Plots lightcurves with Cyg OB7 configuration."""
    # posisbly more economical as a lambda or using *args and **kwargs
    return wuvars_plot.lc(
        table, sid, season, outfile, name, stetson, 
        date_offset=51544, color_slope, custom_xlabel="Time (JD since 04/23/3008)", 
        plot_warn, season_handling_function, abridger_handling_function)

Advanced: a "configurator" module that takes in a "config" file and generates the "cygob7_plot" (and siblings) module/functions automatically, by passing the config arguments into functions-as-arguments.

tomr-stargazer commented 11 years ago

This issue is very similar to Issue #8 .