altuson / tess-asteroids

Create TPFs and LCs for solar system asteroids observed by NASA's TESS mission.
MIT License
0 stars 1 forks source link

Option to return HDU #10

Open jorgemarpa opened 5 days ago

jorgemarpa commented 5 days ago

Can we have an option to return the HDU list in case the user wants to add keywords to the headers? Currently, I need to save moving TPFs with extra information about the asteroid in the header, e.g. target name, median Vmag, and orbital params.

https://github.com/altuson/tess-asteroids/blob/8608663dfe3bf5d6cab053188a73865b1dedfea6/src/tess_asteroids/movingtpf.py#L1164

altuson commented 4 days ago

Yes, absolutely - this was on my list of things to do. A quick fix would be to have a bool to return the HDU list, but I would prefer to add a new function make_hdulist(). This would make the HDU list, then I would update save_data() to save the HDU list to a file. How soon do you need this done?

jorgemarpa commented 4 days ago

I did a quick fix within my local branch for now. I like your idea of having a make_hdulist hidden method. I can work with my change version for now. Also here here's a reference list of keywords we want to include in the header:

    hdul[0].header.set("DATE", datetime.now().strftime("%Y-%m-%d"), comment="file creation date")
    hdul[0].header.set("CREATOR", "tess-asteroids", comment="software used to produce this file")
    hdul[0].header.set("CREATOR", __version__, comment="software version")

    hdul[0].header.set("TSTART", target.time[0], comment="observation start time in TJD of first frame")
    hdul[0].header.set("TSTOP", target.time[-1], comment="observation start time in TJD of last frame")
    hdul[0].header.set("DATE-OBS", Time(target.time[0], format="btjd", scale="tdb").utc.isot, comment="TSTART as UTC calendar date")
    hdul[0].header.set("DATE-END", Time(target.time[-1], format="btjd", scale="tdb").utc.isot, comment="TSTOP as UTC calendar date")

    hdul[0].header.set("OBJECT", catalog.iloc[idx]["Object name"], comment="Asteroid name")
    hdul[0].header.set("VMAG", catalog.iloc[idx]["V_mag"], comment="V magnitude")
    hdul[0].header.set("HMAG", catalog.iloc[idx]["H_mag"], comment="H absolute magnitude")
    hdul[0].header.set("PERIHEL", catalog.iloc[idx]["Perihelion (au)"], comment="Perihelion (au)")
    hdul[0].header.set("ORBECC", catalog.iloc[idx]["Eccentricity"], comment="Orbit eccentricity")
    hdul[0].header.set("ORBINC", catalog.iloc[idx]["Inclination (deg)"], comment="Orbit inclination [deg]")
    hdul[0].header.set("RARATE", catalog.iloc[idx]['RA rate ("/h)'], comment='Right ascension rate ["/h]')
    hdul[0].header.set("DECRATE", catalog.iloc[idx]['Dec rate ("/h)'], comment='Declination rate ["/h]')
altuson commented 4 days ago

Great, thank you! After the aperture photometry PR, when I work on saving the LCF, I will need to update the TPF function too. I'll try and incorporate the update into that PR.