In [1]:
from iuvs import io, hk
In [2]:
hkfiles = io.get_hk_filenames()
In [3]:
hkfiles[0]
Out[3]:
In [1]:
from pathlib import Path
In [2]:
p = Path('/maven_iuvs/production/products/housekeeping/level1a/mvn_iuv_analog_l0_20140610_v001.fits.gz')
In [5]:
p.with_suffix('.h5')
Out[5]:
In [12]:
p.root
Out[12]:
In [4]:
hkdata = hk.HKReader(hkfiles[0])
In [5]:
timestamp_ = hkdata.AnalogConv['SC_CLK_COARSE']
ss = hkdata.AnalogConv['SC_CLK_FINE']
In [6]:
from iuvs.spice import load_kernels
import SpiceyPy as spice
load_kernels()
In [7]:
mavenid, _ = spice.bodn2c('MAVEN')
In [8]:
timestamp = timestamp_ + ss/65536 # timestamp_ and ss are already float
timestamp
Out[8]:
In [9]:
sec = np.uint64(timestamp)
subsec = np.uint64((timestamp-sec)*65536)
In [10]:
def format_times(sec,subsec):
return "{:010d}.{:05d}".format(int(sec), int(subsec))
In [11]:
sclkch = np.vectorize(format_times)(sec, subsec)
In [12]:
sclkdp = np.vectorize(spice.scencd)(mavenid, sclkch)
In [13]:
et = np.vectorize(spice.sct2e)(mavenid, sclkdp)
In [14]:
utc = np.vectorize(spice.et2utc)(et, 'ISOC', 50, 100)
In [15]:
utc = pd.to_datetime(utc)
In [16]:
pd.Series(utc).head()
Out[16]:
In [17]:
import sys
d = {}
for col in hkdata.temp_cols:
data = hkdata.AnalogConv[col]
sys_byteorder = ('>', '<')[sys.byteorder == 'little']
if data.dtype.byteorder not in ('=', sys_byteorder):
d[col] = data.byteswap().newbyteorder(sys_byteorder)
else:
d[col] = data
In [18]:
df = pd.DataFrame(d)
In [20]:
df.index = utc
In [23]:
df.head()
Out[23]:
In [24]:
df.info()
In [26]:
df.FUV_CHIP_TEMP_C.plot()
Out[26]:
In [ ]: