NuSTAR / nustar-clock-utils

Utilities for a precise timing calibration of NuSTAR data
3 stars 3 forks source link

Interactive clock offset cleaner + New clock file production + Diagnostics #9

Closed matteobachetti closed 4 years ago

matteobachetti commented 4 years ago

Resolves #8 and adds a lot of small fixes. image

Moreover, the new algorithm to create the clock correction file improves drastically the handling of time intervals around "bad" times (reboots, missing temperature measurements, etc.) 5msSHIFT 001

bwgref commented 4 years ago

Things I had to do: the linked version of PINT in requirements.txt no longer works because of a deprication of astropy.extern.six in Astropy. However, if I switch to the pip version (pip install pint-pulsar) then things at lease work, but I'm not sure what errors this introduces.

I ran two tests, both using the same underlying files with the syntax:

nustar_clockfile tcxo_tmp_archive.hdf5 latest_clock.dat latest_freq.dat -o test_clock.fits

The first is based on the master branch (v0.1), the second this PR (v0.2)

In performance, it does look like this fixes some of the larger spikes around the instrument turn ons. Here's the bokeh image zoomed in around there for v0.2:

v2

compared with v0.1:

v1_zoomout

...however, there are new spikes in the residual trends in v0.2 that are not present when you zoom in on v0.1:

v1_zoomin

I'm not sure if this is entirely a diagnostics issue or if this is something real that's happening. It looks like it's defaulting to a 1-ms value, which is suspicious that it's not real. But we probably need to address that before I take it live of the production server.

matteobachetti commented 4 years ago

Thanks for the review @bwgref The 1-ms error is indeed what the correction defaults to in all intervals where there are no temperature measurements. In those intervals, the code interpolates linearly between the raw clock offsets, and therefore we declare a 1-ms error that should account for the typical deviation of the real clock delay wrt the linear interpolation