Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lon = T.Float32Col() # Decimal longitude
alt = T.Float32Col() # Altitude, km MSL, WGS84
chi2 = T.Float32Col() # Chi-squared solution quality
power= T.Float32Col() # Radiated power
stations = T.UInt8Col() # Station count
charge = T.Int8Col() # Inferred storm charge
flash_id = T.Int32Col() # Flash ID
mask = T.StringCol(4) # Station mask
class Flash(T.IsDescription):
flash_id = T.Int32Col() # Flash ID
n_points = T.Int16Col()
start = T.Float64Col() # flash start
duration = T.Float32Col() # flash duration
ctr_lat = T.Float32Col() # centroid latitude
ctr_lon = T.Float32Col() # centroid longitude
ctr_alt = T.Float32Col() # centroid altitude
init_lat = T.Float32Col() # initation latitude
init_lon = T.Float32Col() # initation longitude
init_alt = T.Float32Col() # initation altitude
init_pts = T.StringCol(256) # Indices of the points (first point in flash is id=0) used to calc init location
area = T.Float32Col() # area of convex hull of the points comprising the flash
volume = T.Float32Col()
#Changed variable names: 03-20-17 ---> Check make_grids.py in case of inconsistancies.
total_energy = T.Float32Col() #Energy
specific_energy = T.Float32Col() #tot_energy
def write_h5(outfile, flashes, metadata, orig_LMA_file):
# file_parts = lma.filename.split('.')[0].split('_')
# time_code = 'LMA_'+'_'.join(file_parts[1:])
mask = T.StringCol(4) # Station mask
class Flash(T.IsDescription):
flash_id = T.Int32Col() # Flash ID
n_points = T.Int16Col()
start = T.Float64Col() # flash start
duration = T.Float32Col() # flash duration
ctr_lat = T.Float32Col() # centroid latitude
ctr_lon = T.Float32Col() # centroid longitude
ctr_alt = T.Float32Col() # centroid altitude
init_lat = T.Float32Col() # initation latitude
init_lon = T.Float32Col() # initation longitude
init_alt = T.Float32Col() # initation altitude
init_pts = T.StringCol(256) # Indices of the points (first point in flash is id=0) used to calc init location
area = T.Float32Col() # area of convex hull of the points comprising the flash
volume = T.Float32Col()
#Changed variable names: 03-20-17 ---> Check make_grids.py in case of inconsistancies.
total_energy = T.Float32Col() #Energy
specific_energy = T.Float32Col() #tot_energy
def write_h5(outfile, flashes, metadata, orig_LMA_file):
# file_parts = lma.filename.split('.')[0].split('_')
# time_code = 'LMA_'+'_'.join(file_parts[1:])
# LMA_090329_180000_3600
m=metadata # flashes[0].metadata
time_code = 'LMA_%s%02d%02d_%02d%02d%02d_%d' % (str(m.startyear)[-2:], m.startmonth, m.startday,
m.starthour, m.startminute, m.startsecond, m.sec_analyzed)
# orig_columns_LYLOUT = m.columns
h5file = T.open_file(outfile, mode='w', title='Flash-sorted New Mexico Tech LMA Data')
line_stats = tables.Int32Col(shape=(4,))
score = tables.Int32Col()
child_stats = tables.Float32Col(shape=(3, n_actions))
cycle = tables.Int32Col()
value = tables.Float32Col()
variance = tables.Float32Col()
class Loss(tables.IsDescription):
loss_train = tables.Float32Col()
loss_train_value = tables.Float32Col()
loss_train_variance = tables.Float32Col()
loss_train_policy = tables.Float32Col()
loss_validation = tables.Float32Col()
loss_validation_value = tables.Float32Col()
loss_validation_variance = tables.Float32Col()
loss_validation_policy = tables.Float32Col()
loss_ewc = tables.Float32Col()
cycle = tables.Int32Col()
class DataSaver:
def __init__(self, save_dir, save_file, cycle, chunksize=500):
file_name = save_dir + save_file + str(cycle)
self.chunksize = chunksize
self.cycle = cycle
self.file = tables.open_file(file_name, mode='a')
"""
id = tables.UInt32Col()
station_id = tables.UInt8Col()
timestamp = tables.Time32Col()
nanoseconds = tables.UInt32Col()
ext_timestamp = tables.UInt64Col()
r = tables.Float32Col()
phi = tables.Float32Col()
x = tables.Float32Col()
y = tables.Float32Col()
alpha = tables.Float32Col()
N = tables.UInt8Col()
t1 = tables.Float32Col()
t2 = tables.Float32Col()
t3 = tables.Float32Col()
t4 = tables.Float32Col()
n1 = tables.Float32Col()
n2 = tables.Float32Col()
n3 = tables.Float32Col()
n4 = tables.Float32Col()
class Coincidence(tables.IsDescription):
"""Store information about a coincidence of stations within a cluster.
An extensive air shower can trigger multiple stations, resulting in a set
of events which are from the same shower. This is called a coincidence.
This table assigns an :attr:`id` to a coincidence and provides some
additional information. The events making up the coincidence can be looked
return int(s[i:])
class State(tables.IsDescription):
episode = tables.Int32Col()
board = tables.Int8Col(shape=(20, 10))
policy = tables.Float32Col(shape=(n_actions,))
action = tables.Int8Col()
combo = tables.Int32Col()
lines = tables.Int32Col()
line_stats = tables.Int32Col(shape=(4,))
score = tables.Int32Col()
child_stats = tables.Float32Col(shape=(3, n_actions))
cycle = tables.Int32Col()
value = tables.Float32Col()
variance = tables.Float32Col()
class Loss(tables.IsDescription):
loss_train = tables.Float32Col()
loss_train_value = tables.Float32Col()
loss_train_variance = tables.Float32Col()
loss_train_policy = tables.Float32Col()
loss_validation = tables.Float32Col()
loss_validation_value = tables.Float32Col()
loss_validation_variance = tables.Float32Col()
loss_validation_policy = tables.Float32Col()
loss_ewc = tables.Float32Col()
cycle = tables.Int32Col()
class DataSaver:
"""
"""
setpoint = Float32Col()
frame_path = StringCol(140)
ravg = Float32Col()
gavg = Float32Col()
bavg = Float32Col()
# tc_temp=Float32Col()
class DiodePowerScanTableDescription(IsDescription):
"""
"""
setpoint = Float32Col()
eq_time = Float32Col()
class TimestampTableDescription(IsDescription):
"""
"""
timestamp = StringCol(24)
value = Float32Col()
class PowerScanTableDescription(IsDescription):
"""
"""
power_requested = Float32Col()
power_achieved = Float32Col()
if not 'eng' in globals():
import matlab.engine
eng = matlab.engine.start_matlab()
#eng.addpath(eng.genpath('/Users/ajaver/GitHub_repositories/SegWorm/Only_segWorm'));
eng.addpath(eng.genpath('/Users/ajaver/GitHub_repositories/Multiworm_Tracking/OnlySegWorm/'));
eng.warning('off', 'normWorms:VulvaContourTooShort')
eng.warning('off', 'normWorms:NonVulvaContourTooShort')
RESAMPLING_NUM = 65.0
class segworm_results(tables.IsDescription):
#class for the pytables
plate_worms_id = tables.Int32Col(pos=0)
worm_index_joined = tables.Int32Col(pos=1)
frame_number = tables.Int32Col(pos=2)
skeleton = tables.Float32Col(shape = (RESAMPLING_NUM,2), pos=3)
contour_ventral = tables.Float32Col(shape = (RESAMPLING_NUM,2), pos=4)
contour_dorsal = tables.Float32Col(shape = (RESAMPLING_NUM,2), pos=5)
#import StringIO
#out = StringIO.StringIO()
#masked_image_file = '/Volumes/behavgenom$/GeckoVideo/Compressed/20150220/CaptureTest_90pc_Ch3_20022015_183607.hdf5'
#trajectories_file = '/Volumes/behavgenom$/GeckoVideo/Trajectories/20150220/CaptureTest_90pc_Ch3_20022015_183607.hdf5'
#masked_image_file = '/Users/ajaver/Desktop/Gecko_compressed/CaptureTest_90pc_Ch2_18022015_230213.hdf5'
#trajectories_file = '/Users/ajaver/Desktop/Gecko_compressed/Trajectory_CaptureTest_90pc_Ch2_18022015_230213.hdf5'
#masked_image_file = '/Users/ajaver/Desktop/Gecko_compressed/CaptureTest_90pc_Ch2_18022015_230213.hdf5'
#trajectories_file = '/Users/ajaver/Desktop/Gecko_compressed/Trajectory_CaptureTest_90pc_Ch2_18022015_230213.hdf5'
#masked_image_file = '/Users/ajaver/Desktop/Gecko_compressed/prueba/CaptureTest_90pc_Ch1_02022015_141431.hdf5'
label = StringCol(64)
curve_type = EnumCol(curve_type, 'HEAD', base='uint8')
num_points = Int8Col()
class CurvePointsTable(IsDescription):
label = StringCol(64)
x = Float32Col()
y = Float32Col()
class PatternTable(IsDescription):
label = StringCol(72)
num_points = Int32Col()
class PatternPointsTable(IsDescription):
label = StringCol(72)
mult = Float32Col()
#
# NETWORK OPERATIONS TABLES
#
class DemandTable(IsDescription):
junction_label = StringCol(64)
base_demand = Float32Col()
demand_pattern = StringCol(72)
demand_category = StringCol(16)
class ControlTable(IsDescription):
link_label = StringCol(64)
control_type = EnumCol(control_type, 'CONDITIONAL', base='uint8')
status = EnumCol(link_status, 'OPEN', base='uint8')
new_setting = Float32Col()
rotation of the station around its center
.. attribute:: N
number of detectors with at least one particle
"""
id = tables.UInt32Col()
station_id = tables.UInt8Col()
r = tables.Float32Col()
phi = tables.Float32Col()
x = tables.Float32Col()
y = tables.Float32Col()
alpha = tables.Float32Col()
N = tables.UInt8Col()
t1 = tables.Float32Col()
t2 = tables.Float32Col()
t3 = tables.Float32Col()
t4 = tables.Float32Col()
n1 = tables.Float32Col()
n2 = tables.Float32Col()
n3 = tables.Float32Col()
n4 = tables.Float32Col()
class ShowerParticle(tables.IsDescription):
"""Store information about shower particles reaching round level
This table stores particles from shower simulations. For example, AIRES
simulations produce ``grdpcles`` files containing all particles which
reached ground level. These files can be read and their contents can be
stored in this table.
SID = tbl.StringCol(itemsize=16)
path = tbl.StringCol(itemsize=160)
log_analysed = tbl.BoolCol()
successful = tbl.BoolCol()
algorithm = tbl.StringCol(itemsize=16)
cpu_time = tbl.Float32Col()
successful_steps = tbl.Int32Col()
steps_nok = tbl.Int32Col()
timed_out = tbl.BoolCol()
perc_wrong = tbl.Float32Col()
time_events_model = tbl.Int32Col()
time_events_U = tbl.Int32Col()
state_events = tbl.Int32Col()
step_events = tbl.Int32Col()
step_size_min = tbl.Float32Col()
step_size_max = tbl.Float32Col()
int_order_max = tbl.Int32Col()
self.openh5()
# if it's the first simulation, we need to create the Metadata tbl
try:
meta = self.h5.getNode(self.h5.root.Metadata)
except(tbl.NoSuchNodeError):
meta = self.h5.createTable('/', 'Metadata', Meta,
title='All metadata for the simulations')
# check if there's a log file
logfilename = simulation.filename.replace('result_','dslog_')\
.replace('.mat','.txt')