<jupyter_start><jupyter_text>This notebook shows how to manipulate the times in NuSTAR event files from various time codes.The "TIME" column in the NuSTAR event files is the TT seconds since '2010-01-01:00:00:00' UTC. Note that TT is offset from UTC by the number of leap seconds. This roughly 68 seconds of offset, with UTC lagging behind TT. NOTE:For any astrophysical timing analysis you *must* use barycorr to barycenter the event fimes before you do anything else.Barycorr returns events in barycentric dynamic time (a.k.a. the "TBD" time system), which is effectively the TT time scale but with the relative time shifts between NuSTAR and the barycenter taken out.Fortunately, Astropy Time constructs know about the various time scales, so we can convert times at will.  Converting MET (in either TDB from barycorr or seconds since the UTC epoch) to a Time object:<jupyter_code>from nustar_gen import info
from astropy.time import Time
ns = info.NuSTAR()
# Convert a random date to met seconds
time = Time('2020-01-01T12:34:42', format = 'fits', scale = 'utc')
met = ns.time_to_met(time)
print(met)
# Confirm we get the correct conversion back:
time = ns.met_to_time(met)
print(time.utc)
# Also works on lists of times:
import numpy as np
mets = met + np.arange(100)
times = ns.met_to_time(mets)
times<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.068810770381451, 'fraction_numerical': 0.02468212415856395, 'mean_word_length': 5.027027027027027, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '313036', 'license': 'MIT', 'n_tokens_mistral': 435, 'n_tokens_neox': 387, 'n_words': 188, 'path': 'notebooks/TimeExample.ipynb', 'repo_name': 'bwgref/nustar-gen-utils', 'size': '1337'}