In [1]:
%matplotlib inline
import mpld3
mpld3.enable_notebook()
import matplotlib.pyplot as plt
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:52:58.427227. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [2]:
import ifg.shis.rdr.valid as val
from pyfbf import Workspace
import numpy as np
W = Workspace('scatter_test/rdr20170323T170847end20170323T233859sdr20170324T194155')
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:00.742166. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [3]:
debug = {}
ok, seg = val.segments(W, debug=debug)
/data/users/rayg/Repos/svn/SHIS/py/ifg_shis/ifg/shis/rdr/valid.py:151: RuntimeWarning: invalid value encountered in greater_equal
  high_enough = (alt >= limits.min_altitude)
/data/users/rayg/Repos/svn/SHIS/py/ifg_shis/ifg/shis/rdr/valid.py:157: RuntimeWarning: invalid value encountered in less
  level = (abs(pitch) < limits.max_pitch) & (abs(roll) < limits.max_roll)
/data/users/rayg/Repos/svn/SHIS/py/ifg_shis/ifg/shis/rdr/valid.py:159: RuntimeWarning: invalid value encountered in greater
  attitude_changing = diffmask(abs(np.diff(pitch)) > limits.max_delta_pitch) | diffmask(abs(np.diff(roll)) > limits.max_delta_roll)
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:02.800872. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [4]:
fig = plt.figure(figsize=(15,10))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(seg)
ax.set_title('segmentize unit test for sh170323')
/home/rayg/.conda/envs/shis/lib/python2.7/site-packages/matplotlib/cbook.py:136: MatplotlibDeprecationWarning: The axisbg attribute was deprecated in version 2.0. Use facecolor instead.
  warnings.warn(message, mplDeprecation, stacklevel=1)
Out[4]:
<matplotlib.text.Text at 0x7fa85805f090>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:04.253017. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [5]:
pitch,roll,segments,smp,sequences = W['Pitch'][:], W['Roll'][:], W['segments'][:], W['sceneMirrorPosition'][:], W['intactMirrorSequences'][:]
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:10.381782. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [6]:
old_segments = segments
config = val.DEFAULT_SEGMENT_LIMITS
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:11.638242. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [7]:
config = config._replace(min_turn_segment_width=29, min_segment_width=128)
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:19.363280. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [8]:
masks = val.segments_and_sequences(W, seg_limits=config)
segments = masks.segments.astype(np.int32)
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:24.746757. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [9]:
gudrex = np.argwhere(smp==ord('E'))

fig = plt.figure(figsize=(15,10))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(gudrex, segments[gudrex], alpha=0.7, color='blue')
ax.plot(gudrex, old_segments[gudrex], alpha=0.7, color='green')
ax.legend(['test segmentize', 'original segments'])
ax.set_title('segments.int4 test for E views sh170323')
Out[9]:
<matplotlib.text.Text at 0x7fa8514fc190>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:29.314717. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [10]:
' '.join(str(x) for x in sorted(set(seg))), ' '.join(str(x) for x in sorted(set(segments)))
Out[10]:
('-30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24',
 '-72 -71 -70 -69 -68 -67 -66 -65 -64 -63 -62 -61 -60 -59 -58 -57 -56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -14 -13 -12 -11 -10 -9 -8 -7 -6 0 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28')
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:42.969151. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [11]:
fig = plt.figure(figsize=(15,10))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(roll, alpha=0.7, color='blue', linewidth=0.5)
ax.plot(pitch, alpha=0.7, color='green', linewidth=0.5)
ax.legend(['Roll', 'Pitch'])
# ax.set_title()
Out[11]:
<matplotlib.legend.Legend at 0x7fa851e76190>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:46.065878. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [12]:
s,e = 10000,25000

fig = plt.figure(figsize=(15,10))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(roll[s:e], alpha=0.7, linewidth=0.5, color='blue')
ax.plot(roll[s:e], alpha=0.7, linewidth=0.5, color='green')
ax.plot(np.sign(seg[s:e]) * 20, linewidth=0.5, color='red')
# plot(np.require(ok[s:e], dtype=np.int32) * 25)
ax.legend(['Roll', 'Pitch', 'segments sign'])
ax.set_title('Attitude excerpt sh170323')
ax.set_xlabel('record offset')
ax.set_ylabel('degrees')
Out[12]:
<matplotlib.text.Text at 0x7fa851de7e10>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:53:58.801119. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [13]:
unroll, turnroll, flatroll, calroll = np.array(roll), np.array(roll), np.array(roll), np.array(roll)
eview = smp==ord('E')
unroll[(segments!=0) | ~eview] = np.NAN
turnroll[(segments>=0) | ~eview] = np.NAN
flatroll[(segments<=0) | ~eview] = np.NAN
calroll[eview] = np.NAN

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid') 
ax.plot(calroll, alpha=0.7, linewidth=0.5, color='purple')
ax.plot(unroll, alpha=0.9, linewidth=0.5, color='red')
ax.plot(flatroll, alpha=0.9, linewidth=0.5, color='blue')
ax.plot(turnroll, alpha=0.9, linewidth=0.5, color='green')

ax.set_title('Roll for Segment-Categorized Views')
ax.legend(['not earth', 'segments==0', 'segments>0', 'segments<0'])
Out[13]:
<matplotlib.legend.Legend at 0x7fa8516ba890>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:54:03.675669. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [14]:
unpitch, turnpitch, flatpitch, calpitch = np.array(pitch), np.array(pitch), np.array(pitch), np.array(pitch)
eview = smp==ord('E')
unpitch[(segments!=0) | ~eview] = np.NAN
turnpitch[(segments>=0) | ~eview] = np.NAN
flatpitch[(segments<=0) | ~eview] = np.NAN
calpitch[eview] = np.NAN

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(calpitch, alpha=0.6, linewidth=0.5, color='purple')
ax.plot(unpitch, alpha=0.9, linewidth=0.5, color='red')
ax.plot(flatpitch, alpha=0.9, linewidth=0.5, color='blue')
ax.plot(turnpitch, alpha=0.9, linewidth=0.5, color='green')

ax.set_title('pitch for Segment-Categorized Views')
ax.legend(['not earth', 'segments==0', 'segments>0', 'segments<0'])
Out[14]:
<matplotlib.legend.Legend at 0x7fa8515c3b10>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:54:10.685252. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [15]:
lat, lon = W['instrumentLatitude'][:], W['instrumentLongitude'][:]

unlat, turnlat, flatlat, callat = np.array(lat), np.array(lat), np.array(lat), np.array(lat)
eview = smp==ord('E')
unlat[(segments!=0) | (lat==0) | ~eview] = np.NAN
turnlat[(segments>=0) | (lat==0) | ~eview] = np.NAN
flatlat[(segments<=0) | (lat==0) | ~eview] = np.NAN
callat[eview | (lon==0)] = np.NAN

unlon, turnlon, flatlon, callon = np.array(lon), np.array(lon), np.array(lon), np.array(lon)
eview = smp==ord('E')
unlon[(segments!=0) | (lon==0) | ~eview] = np.NAN
turnlon[(segments>=0) | (lon==0) | ~eview] = np.NAN
flatlon[(segments<=0) | (lon==0) | ~eview] = np.NAN
callon[eview | (lon==0)] = np.NAN

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(callon, callat, alpha=0.6, linewidth=0.5, color='purple')
ax.plot(unlon, unlat, alpha=0.9, linewidth=0.5, color='red')
ax.plot(flatlon, flatlat, alpha=0.9, linewidth=0.5, color='blue')
ax.plot(turnlon, turnlat, alpha=0.9, linewidth=0.5, color='green')

ax.set_title('flight track for Segment-Categorized Views')
ax.legend(['not earth', 'segments==0', 'segments>0', 'segments<0'])
Out[15]:
<matplotlib.legend.Legend at 0x7fa84f5eb950>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-27 18:54:16.634625. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [ ]:
s,e = 11000, 23000

fig = plt.figure(figsize=(15,15))kk
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')

ax.plot(callon[s:e], callat[s:e], alpha=0.4, linewidth=10, color='purple')
ax.plot(unlon[s:e], unlat[s:e], alpha=0.6, linewidth=10, color='red')
ax.plot(flatlon[s:e], flatlat[s:e], alpha=0.6, linewidth=10, color='blue')
ax.plot(turnlon[s:e], turnlat[s:e], alpha=0.6, linewidth=10, color='green')

fovlat, fovlon = W['Latitude'][:], W['Longitude'][:]

funlat, fturnlat, fflatlat, fcallat = np.array(fovlat), np.array(fovlat), np.array(fovlat), np.array(fovlat)
eview = smp==ord('E')
funlat[(segments!=0) | (lat==0) | ~eview] = np.NAN
fturnlat[(segments>=0) | (lat==0) | ~eview] = np.NAN
fflatlat[(segments<=0) | (lat==0) | ~eview] = np.NAN
fcallat[eview | (lon==0)] = np.NAN

funlon, fturnlon, fflatlon, fcallon = np.array(fovlon), np.array(fovlon), np.array(fovlon), np.array(fovlon)
eview = smp==ord('E')
funlon[(segments!=0) | (lon==0) | ~eview] = np.NAN
fturnlon[(segments>=0) | (lon==0) | ~eview] = np.NAN
fflatlon[(segments<=0) | (lon==0) | ~eview] = np.NAN
fcallon[eview | (lon==0)] = np.NAN


# ax.plot(callon[s:e], callat[s:e], alpha=0.6, linewidth=0.5, color='purple')
ax.plot(funlon[s:e], funlat[s:e], '.', alpha=0.9, linewidth=0.5, color='red')
ax.plot(fflatlon[s:e], fflatlat[s:e], '.', alpha=0.9, linewidth=0.5, color='blue')
ax.plot(fturnlon[s:e], fturnlat[s:e], '.', alpha=0.9, linewidth=0.5, color='green')

ax.set_title('FOV track for Segment-Categorized Views')
ax.legend(['not earth', 'segments==0', 'segments>0', 'segments<0'])
In [ ]: