In [1]:
%matplotlib inline
from pylab import *
import ifg.shis.rdr.valid as val
from pyfbf import Workspace
import numpy as np
W = Workspace('scatter_test/rdr20170321T183218end20170322T013232sdr20170324T202151')
In [2]:
L = 47000
lms = ['lw', 'mw', 'sw']
pfx = 'calibrtn'
zlw, zmw, zsw = map(lambda x: W[pfx + x.upper()][:L], lms)
smp = W.sceneMirrorPosition[:L]
s,e = 0,L
cc = W["coolerCurrent"][s:e].ravel()
det = W["detectorTemp"][s:e].ravel()
abb = W["ABBapexTemp"][s:e].ravel()
hbb = W["HBBapexTemp"][s:e].ravel()
smp = W["sceneMirrorPosition"][s:e].ravel()
sd = W['scanDirection'][s:e].ravel()
In [3]:
goodcal = ((zlw == 1) & (zmw == 1) & (zsw == 1))
len(np.argwhere(goodcal==True).squeeze()), L
Out[3]:
(38719, 47000)
In [4]:
len(np.argwhere(goodcal[30000:40000]==True).squeeze())
Out[4]:
8553
In [5]:
len(np.argwhere(goodcal[20000:30000]==True).squeeze())
Out[5]:
8550
In [6]:
notgood = ((~goodcal) & (smp==ord('E')))
len(np.argwhere(notgood==True).squeeze()), L
Out[6]:
(961, 47000)
In [7]:
figure(figsize=(20,10))
hist(np.argwhere(notgood==True).squeeze(), bins=48)
Out[7]:
(array([  82.,  232.,  234.,  131.,    0.,    0.,    0.,   14.,    0.,
           0.,    6.,    0.,    0.,    0.,    6.,    0.,    0.,    0.,
          13.,    0.,    0.,   14.,    0.,    0.,    0.,   14.,    0.,
           0.,   13.,    0.,    0.,    0.,   13.,    0.,    0.,    0.,
           6.,    0.,    0.,   14.,    0.,    0.,   13.,   55.,    0.,
           0.,   51.,   50.]),
 array([  9.00000000e+00,   9.77895833e+02,   1.94679167e+03,
          2.91568750e+03,   3.88458333e+03,   4.85347917e+03,
          5.82237500e+03,   6.79127083e+03,   7.76016667e+03,
          8.72906250e+03,   9.69795833e+03,   1.06668542e+04,
          1.16357500e+04,   1.26046458e+04,   1.35735417e+04,
          1.45424375e+04,   1.55113333e+04,   1.64802292e+04,
          1.74491250e+04,   1.84180208e+04,   1.93869167e+04,
          2.03558125e+04,   2.13247083e+04,   2.22936042e+04,
          2.32625000e+04,   2.42313958e+04,   2.52002917e+04,
          2.61691875e+04,   2.71380833e+04,   2.81069792e+04,
          2.90758750e+04,   3.00447708e+04,   3.10136667e+04,
          3.19825625e+04,   3.29514583e+04,   3.39203542e+04,
          3.48892500e+04,   3.58581458e+04,   3.68270417e+04,
          3.77959375e+04,   3.87648333e+04,   3.97337292e+04,
          4.07026250e+04,   4.16715208e+04,   4.26404167e+04,
          4.36093125e+04,   4.45782083e+04,   4.55471042e+04,
          4.65160000e+04]),
 <a list of 48 Patch objects>)
In [8]:
notgoodlw = ((zlw!=1) & (smp==ord('E')))
figure(figsize=(20,10))
hist(np.argwhere(notgoodlw==True).squeeze(), bins=48)
Out[8]:
(array([  82.,  232.,  234.,  131.,    0.,    0.,    0.,   14.,    0.,
           0.,    6.,    0.,    0.,    0.,    6.,    0.,    0.,    0.,
          13.,    0.,    0.,   14.,    0.,    0.,    0.,   14.,    0.,
           0.,   13.,    0.,    0.,    0.,   13.,    0.,    0.,    0.,
           6.,    0.,    0.,   14.,    0.,    0.,   13.,   55.,    0.,
           0.,   51.,   50.]),
 array([  9.00000000e+00,   9.77895833e+02,   1.94679167e+03,
          2.91568750e+03,   3.88458333e+03,   4.85347917e+03,
          5.82237500e+03,   6.79127083e+03,   7.76016667e+03,
          8.72906250e+03,   9.69795833e+03,   1.06668542e+04,
          1.16357500e+04,   1.26046458e+04,   1.35735417e+04,
          1.45424375e+04,   1.55113333e+04,   1.64802292e+04,
          1.74491250e+04,   1.84180208e+04,   1.93869167e+04,
          2.03558125e+04,   2.13247083e+04,   2.22936042e+04,
          2.32625000e+04,   2.42313958e+04,   2.52002917e+04,
          2.61691875e+04,   2.71380833e+04,   2.81069792e+04,
          2.90758750e+04,   3.00447708e+04,   3.10136667e+04,
          3.19825625e+04,   3.29514583e+04,   3.39203542e+04,
          3.48892500e+04,   3.58581458e+04,   3.68270417e+04,
          3.77959375e+04,   3.87648333e+04,   3.97337292e+04,
          4.07026250e+04,   4.16715208e+04,   4.26404167e+04,
          4.36093125e+04,   4.45782083e+04,   4.55471042e+04,
          4.65160000e+04]),
 <a list of 48 Patch objects>)
In [9]:
notgoodmw = ((zmw!=1) & (smp==ord('E')))
figure(figsize=(20,10))
hist(np.argwhere(notgoodmw==True).squeeze(), bins=48)
Out[9]:
(array([  82.,  232.,  234.,  131.,    0.,    0.,    0.,   14.,    0.,
           0.,    6.,    0.,    0.,    0.,    6.,    0.,    0.,    0.,
          13.,    0.,    0.,   14.,    0.,    0.,    0.,   14.,    0.,
           0.,   13.,    0.,    0.,    0.,   13.,    0.,    0.,    0.,
           6.,    0.,    0.,   14.,    0.,    0.,   13.,   55.,    0.,
           0.,   51.,   50.]),
 array([  9.00000000e+00,   9.77895833e+02,   1.94679167e+03,
          2.91568750e+03,   3.88458333e+03,   4.85347917e+03,
          5.82237500e+03,   6.79127083e+03,   7.76016667e+03,
          8.72906250e+03,   9.69795833e+03,   1.06668542e+04,
          1.16357500e+04,   1.26046458e+04,   1.35735417e+04,
          1.45424375e+04,   1.55113333e+04,   1.64802292e+04,
          1.74491250e+04,   1.84180208e+04,   1.93869167e+04,
          2.03558125e+04,   2.13247083e+04,   2.22936042e+04,
          2.32625000e+04,   2.42313958e+04,   2.52002917e+04,
          2.61691875e+04,   2.71380833e+04,   2.81069792e+04,
          2.90758750e+04,   3.00447708e+04,   3.10136667e+04,
          3.19825625e+04,   3.29514583e+04,   3.39203542e+04,
          3.48892500e+04,   3.58581458e+04,   3.68270417e+04,
          3.77959375e+04,   3.87648333e+04,   3.97337292e+04,
          4.07026250e+04,   4.16715208e+04,   4.26404167e+04,
          4.36093125e+04,   4.45782083e+04,   4.55471042e+04,
          4.65160000e+04]),
 <a list of 48 Patch objects>)
In [10]:
notgoodsw = ((zsw!=1) & (smp==ord('E')))
figure(figsize=(20,10))
hist(np.argwhere(notgoodsw==True).squeeze(), bins=48)
Out[10]:
(array([  82.,  232.,  234.,  131.,    0.,    0.,    0.,   14.,    0.,
           0.,    6.,    0.,    0.,    0.,    6.,    0.,    0.,    0.,
          13.,    0.,    0.,   14.,    0.,    0.,    0.,   14.,    0.,
           0.,   13.,    0.,    0.,    0.,   13.,    0.,    0.,    0.,
           6.,    0.,    0.,   14.,    0.,    0.,   13.,   55.,    0.,
           0.,   51.,   50.]),
 array([  9.00000000e+00,   9.77895833e+02,   1.94679167e+03,
          2.91568750e+03,   3.88458333e+03,   4.85347917e+03,
          5.82237500e+03,   6.79127083e+03,   7.76016667e+03,
          8.72906250e+03,   9.69795833e+03,   1.06668542e+04,
          1.16357500e+04,   1.26046458e+04,   1.35735417e+04,
          1.45424375e+04,   1.55113333e+04,   1.64802292e+04,
          1.74491250e+04,   1.84180208e+04,   1.93869167e+04,
          2.03558125e+04,   2.13247083e+04,   2.22936042e+04,
          2.32625000e+04,   2.42313958e+04,   2.52002917e+04,
          2.61691875e+04,   2.71380833e+04,   2.81069792e+04,
          2.90758750e+04,   3.00447708e+04,   3.10136667e+04,
          3.19825625e+04,   3.29514583e+04,   3.39203542e+04,
          3.48892500e+04,   3.58581458e+04,   3.68270417e+04,
          3.77959375e+04,   3.87648333e+04,   3.97337292e+04,
          4.07026250e+04,   4.16715208e+04,   4.26404167e+04,
          4.36093125e+04,   4.45782083e+04,   4.55471042e+04,
          4.65160000e+04]),
 <a list of 48 Patch objects>)
In [11]:
notgoodf = ((~goodcal) & (smp==ord('E')) & (sd==ord('F')))
figure(figsize=(20,10))
hist(np.argwhere(notgoodf==True).squeeze(), bins=48)
title('histogram of bad ' + pfx.upper() + ' status for FWD Earth views')
xlabel('record #')
Out[11]:
<matplotlib.text.Text at 0x7fce7de6ba90>
In [12]:
notgoodb = ((~goodcal) & (smp==ord('E')) & (sd==ord('B')))
figure(figsize=(20,10))
hist(np.argwhere(notgoodb==True).squeeze(), bins=48)
title('histogram of bad ' + pfx.upper() + ' status for BWD Earth views')
xlabel('record #')
Out[12]:
<matplotlib.text.Text at 0x7fce7b2755d0>
In [13]:
qcim = W['qc_rad_imag_threshold'][:L]
figure(figsize=(20,10))
hist(np.argwhere((qcim!=1) & (smp==ord('E')) & (sd==ord('F'))).squeeze(), bins=48)
title('histogram fwd earth view qc_rad_imag_threshold!=1')
Out[13]:
<matplotlib.text.Text at 0x7fce7b097150>
In [14]:
figure(figsize=(20,10))
hist(np.argwhere((qcim!=1) & (smp==ord('E')) & (sd==ord('B'))).squeeze(), bins=48)
title('histogram bwd earth view qc_rad_imag_threshold!=1')
Out[14]:
<matplotlib.text.Text at 0x7fce7aecd410>
In [15]:
lw, mw, sw = W.SpectrumLW_CalRad_Resampled, W.SpectrumMW_CalRad_Resampled, W.SpectrumSW_CalRad_Resampled
In [16]:
figure(figsize=(20,10))
s,e = 30032,30047
plot(lw[s:e].transpose())
zlw[s:e], ''.join(chr(int(x)) for x in smp[s:e])
Out[16]:
(memmap([ 1,  1,  1,  1, -1, -1,  1,  1,  1,  1, -1,  1,  1,  1,  1], dtype=int8),
 'EEEE??AAAA?HHHH')
In [17]:
figure(figsize=(20,10))
# s,e = 30032,30047
plot(sw[s:e].transpose())
zsw[s:e], ''.join(chr(int(x)) for x in smp[s:e])
Out[17]:
(memmap([ 1,  1,  1,  1, -1, -1,  1,  1,  1,  1, -1,  1,  1,  1,  1], dtype=int8),
 'EEEE??AAAA?HHHH')
In [18]:
nlw, nmw = W.SpectrumLW_NLC, W.SpectrumMW_NLC
In [19]:
s,e = 30000, 34000
rex = np.argwhere((smp[s:e]==ord("E")) & (sd[s:e]==ord("F"))).squeeze() + s
len(rex)
Out[19]:
1169
In [20]:
figure(figsize=(20,10))
plot(np.real(nlw[rex]).transpose())
len(rex)
grid()
In [21]:
figure(figsize=(20,10))
plot(np.imag(nlw[rex]).transpose())
len(rex)
grid()
In [22]:
rex = np.argwhere((smp[s:e]==ord("E")) & (sd[s:e]==ord("B"))).squeeze() + s
figure(figsize=(20,10))
plot(np.real(nlw[rex]).transpose())
len(rex)
grid()
In [23]:
figure(figsize=(20,10))
plot(np.imag(nlw[rex]).transpose())
len(rex)
grid()
In [24]:
len(np.argwhere((zlw[s:e]==1) & (smp[s:e]==ord("E")))), len(np.argwhere((smp[s:e]==ord("E"))))
Out[24]:
(2323, 2336)
In [25]:
len(np.argwhere((zmw[s:e]==1) & (smp[s:e]==ord("E")))), len(np.argwhere((smp[s:e]==ord("E"))))
Out[25]:
(2323, 2336)
In [26]:
sma, fova =W['sceneMirrorAngle'], W['FOVangle']
figure(figsize=(20,10))
badrex = np.argwhere(zlw[s:e]!=1).squeeze() + s
gudrex = np.argwhere(zlw[s:e]==1).squeeze() + s
plot(gudrex, fova[gudrex], '.', color='b')
plot(badrex, fova[badrex], '.', color='r')
s,e
Out[26]:
(30000, 34000)
In [27]:
figure(figsize=(20,10))
badrex = np.argwhere(zmw[s:e]!=1).squeeze() + s
gudrex = np.argwhere(zmw[s:e]==1).squeeze() + s
plot(gudrex, fova[gudrex], '.', color='b')
plot(badrex, fova[badrex], '.', color='r')
plus45rex = np.argwhere((fova[s:e]>45.0) & (fova[s:e]<50.0)).squeeze() + s
plot(plus45rex, fova[plus45rex], 'o', color='orange')
minus45rex = np.argwhere((fova[s:e]<-45.0) & (fova[s:e]>-50.0)).squeeze() + s
if len(minus45rex):
    plot(minus45rex, fova[minus45rex], 'o', color='orange')
else:
    print('no -45>fovangle>-50')
/data/home/rayg/.conda/envs/shis/lib/python2.7/site-packages/ipykernel/__main__.py:6: RuntimeWarning: invalid value encountered in greater
/data/home/rayg/.conda/envs/shis/lib/python2.7/site-packages/ipykernel/__main__.py:6: RuntimeWarning: invalid value encountered in less
/data/home/rayg/.conda/envs/shis/lib/python2.7/site-packages/ipykernel/__main__.py:8: RuntimeWarning: invalid value encountered in less
/data/home/rayg/.conda/envs/shis/lib/python2.7/site-packages/ipykernel/__main__.py:8: RuntimeWarning: invalid value encountered in greater
no -45>fovangle>-50
In [ ]: