Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#########################################################################
#extract data for IMIR_HK_FW_POS_VOLT under given condition
con_set_FW = [ \
cond.greater(m.mnemonic('IMIR_HK_FW_POS_VOLT'),250.0)]
#setup condition
condition_FW = cond.condition(con_set_FW)
FW_volt = extract_data(condition_FW, m.mnemonic('IMIR_HK_FW_POS_VOLT'))
returndata.update({'IMIR_HK_FW_POS_VOLT':FW_volt})
del condition_FW
#extract data for IMIR_HK_GW14_POS_VOLT under given condition
con_set_GW14 = [ \
cond.greater(m.mnemonic('IMIR_HK_GW14_POS_VOLT'),250.0)]
#setup condition
condition_GW14 = cond.condition(con_set_GW14)
GW14_volt = extract_data(condition_GW14, m.mnemonic('IMIR_HK_GW14_POS_VOLT'))
returndata.update({'IMIR_HK_GW14_POS_VOLT':GW14_volt})
del condition_GW14
#extract data for IMIR_HK_GW23_POS_VOLT under given condition
con_set_GW23 = [ \
cond.greater(m.mnemonic('IMIR_HK_GW23_POS_VOLT'),250.0)]
#setup condition
condition_GW23 = cond.condition(con_set_GW23)
GW23_volt = extract_data(condition_GW23, m.mnemonic('IMIR_HK_GW23_POS_VOLT'))
returndata.update({'IMIR_HK_GW23_POS_VOLT':GW23_volt})
del condition_GW23
#extract data for IMIR_HK_CCC_POS_VOLT under given condition
con_set_CCC = [ \
cond.greater(m.mnemonic('IMIR_HK_CCC_POS_VOLT'),250.0)]
del condition_FW
con_set_GW14 = [ \
cond.greater(m['IMIR_HK_GW14_POS_VOLT'], 250.0)]
# setup condition
condition_GW14 = cond.condition(con_set_GW14)
GW14 = extract_filterpos(condition_GW14, mn.gw14_nominals, \
m['IMIR_HK_GW14_POS_RATIO'], m['IMIR_HK_GW14_CUR_POS'])
del condition_GW14
con_set_GW23 = [ \
cond.greater(m['IMIR_HK_GW23_POS_VOLT'], 250.0)]
# setup condition
condition_GW23 = cond.condition(con_set_GW23)
GW23 = extract_filterpos(condition_GW23, mn.gw23_nominals, \
m['IMIR_HK_GW23_POS_RATIO'], m['IMIR_HK_GW23_CUR_POS'])
del condition_GW23
con_set_CCC = [ \
cond.greater(m['IMIR_HK_CCC_POS_VOLT'], 250.0)]
# setup condition
condition_CCC = cond.condition(con_set_CCC)
CCC = extract_filterpos(condition_CCC, mn.ccc_nominals, \
m['IMIR_HK_CCC_POS_RATIO'], m['IMIR_HK_CCC_CUR_POS'])
del condition_CCC
return FW, GW14, GW23, CCC
list of touples with start and end time
"""
temp_start: float = []
temp_end: float = []
for key in self.mnemonic:
# find all times whose Raw values are grater than the given value
if float(key['value']) < self.value:
temp_start.append(key["time"])
# find all end values
else:
temp_end.append(key["time"])
time_p = condition.generate_time_pairs(temp_start, temp_end)
return time_p
extracted data for IMIR_HK_GW14_POS_VOLT
GW23_volt : list
extracted data for IMIR_HK_GW23_POS_VOLT
CCC_volt : list
extracted data for IMIR_HK_CCC_POS_VOLT
'''
#abbreviate attribute
m = mnemonic_data
returndata = dict()
#########################################################################
con_set_3 = [ \
cond.greater(m.mnemonic('IMIR_HK_ICE_SEC_VOLT1'), 25.0)]
#setup condition
condition_3 = cond.condition(con_set_3)
#add filtered engineering values of mnemonics given in list mnemonic_cond_3
#to dictitonary
for identifier in mn.mnemonic_cond_3:
data = extract_data(condition_3, m.mnemonic(identifier))
if data != None:
returndata.update({identifier:data})
else:
print("no data for {}".format(identifier))
del condition_3
#########################################################################
#extract data for IMIR_HK_FW_POS_VOLT under given condition
con_set_FW = [ \
for key in self.mnemonic:
# find all times whoses Raw values equal the given value
if key['value'] == self.value:
temp_start.append(key["time"])
# find all end values
else:
temp_end.append(key["time"])
time_p = condition.generate_time_pairs(temp_start, temp_end)
return time_p
class greater(condition):
"""Class to hold single "greater than" subcondition"""
# add attributes to function - start function "cond_time_pairs()"
def __init__(self, mnemonic, value):
"""Initializes subconditon
Parameters
----------
mnemonic : astropy table
includes mnemomic engineering data and corresponding primary time
value : str
coparison value for equal statement
"""
self.mnemonic = mnemonic
self.value = value
condition.cond_time_pairs.append((self.cond_true_time()))
del condition_GW14
con_set_GW23 = [ \
cond.greater(m.mnemonic('IMIR_HK_GW23_POS_VOLT'),250.0)]
#setup condition
condition_GW23 = cond.condition(con_set_GW23)
GW23 = extract_filterpos(condition_GW23, mn.gw23_nominals, \
m.mnemonic('IMIR_HK_GW23_POS_RATIO'), m.mnemonic('IMIR_HK_GW23_CUR_POS'))
del condition_GW23
con_set_CCC = [ \
cond.greater(m.mnemonic('IMIR_HK_CCC_POS_VOLT'),250.0)]
#setup condition
condition_CCC = cond.condition(con_set_CCC)
CCC = extract_filterpos(condition_CCC, mn.ccc_nominals, \
m.mnemonic('IMIR_HK_CCC_POS_RATIO'), m.mnemonic('IMIR_HK_CCC_CUR_POS'))
del condition_CCC
return FW, GW14, GW23, CCC
extracted data for IMIR_HK_GW14_POS_VOLT
GW23_volt : list
extracted data for IMIR_HK_GW23_POS_VOLT
CCC_volt : list
extracted data for IMIR_HK_CCC_POS_VOLT
"""
log = log_error_and_file.Log('Process')
m = mnemonic_data
returndata = dict()
# Define Condition Set 3
# add filtered engineering values of mnemonics given in list mnemonic_cond_3
con_set_3 = [
cond.greater(m['IMIR_HK_ICE_SEC_VOLT1'], 25.0)]
condition_3 = cond.condition(con_set_3)
for identifier in mn.mnemonic_cond_3:
data = extract_data.extract_data(condition_3, m[identifier])
if data is not None:
returndata.update({identifier: data})
log.log('Check condition 3 Succesful for ' + identifier)
else:
log.log('NO data in condition 3 for ' + identifier, 'Error')
del condition_3
# Define Condition Set FW
# add filtered engineering values of mnemonics given in list mnemonic_cond_FW
con_set_FW = [
cond.greater(m['IMIR_HK_FW_POS_VOLT'], 250.0)]
condition_FW = cond.condition(con_set_FW)
del condition_GW14
# extract data for IMIR_HK_GW23_POS_VOLT under given condition
con_set_GW23 = [ \
cond.greater(m['IMIR_HK_GW23_POS_VOLT'], 250.0)]
# setup condition
condition_GW23 = cond.condition(con_set_GW23)
GW23_volt = extract_data(condition_GW23, m['IMIR_HK_GW23_POS_VOLT'])
returndata.update({'IMIR_HK_GW23_POS_VOLT': GW23_volt})
del condition_GW23
# extract data for IMIR_HK_CCC_POS_VOLT under given condition
con_set_CCC = [ \
cond.greater(m['IMIR_HK_CCC_POS_VOLT'], 250.0)]
# setup condition
condition_CCC = cond.condition(con_set_CCC)
CCC_volt = extract_data(condition_CCC, m['IMIR_HK_CCC_POS_VOLT'])
returndata.update({'IMIR_HK_CCC_POS_VOLT': CCC_volt})
del condition_CCC
return returndata
for identifier in mn.mnemonic_cond_3:
data = extract_data.extract_data(condition_3, m[identifier])
if data is not None:
returndata.update({identifier: data})
log.log('Check condition 3 Succesful for ' + identifier)
else:
log.log('NO data in condition 3 for ' + identifier, 'Error')
del condition_3
# Define Condition Set FW
# add filtered engineering values of mnemonics given in list mnemonic_cond_FW
con_set_FW = [
cond.greater(m['IMIR_HK_FW_POS_VOLT'], 250.0)]
condition_FW = cond.condition(con_set_FW)
FW_volt = extract_data.extract_data(condition_FW, m['IMIR_HK_FW_POS_VOLT'])
returndata.update({'IMIR_HK_FW_POS_VOLT': FW_volt})
del condition_FW
log.log('Check condition IMIR_HK_FW_POS_VOLT > 250')
# Define Condition Set GW
# add filtered engineering values of mnemonics given in list mnemonic_cond_GW
con_set_GW14 = [
cond.greater(m['IMIR_HK_GW14_POS_VOLT'], 250.0)]
condition_GW14 = cond.condition(con_set_GW14)
GW14_volt = extract_data.extract_data(condition_GW14, m['IMIR_HK_GW14_POS_VOLT'])
returndata.update({'IMIR_HK_GW14_POS_VOLT': GW14_volt})
del condition_GW14
log.log('Check condition IMIR_HK_GW14_POS_VOLT > 250')
if data != None:
returndata.update({identifier: data})
print_string = DateTime.now().isoformat() + ' Process day: ' + identifier + '\t' + 'cond3 Success'
print(print_string)
else:
print_string = DateTime.now().isoformat() + ' Process day: ' + identifier + '\t' + 'cond3 no data'
print('\33[31m' + print_string + '\033[0m')
del condition_3
#########################################################################
# extract data for IMIR_HK_FW_POS_VOLT under given condition
con_set_FW = [ \
cond.greater(m['IMIR_HK_FW_POS_VOLT'], 250.0)]
# setup condition
condition_FW = cond.condition(con_set_FW)
FW_volt = extract_data(condition_FW, m['IMIR_HK_FW_POS_VOLT'])
returndata.update({'IMIR_HK_FW_POS_VOLT': FW_volt})
del condition_FW
# extract data for IMIR_HK_GW14_POS_VOLT under given condition
con_set_GW14 = [ \
cond.greater(m['IMIR_HK_GW14_POS_VOLT'], 250.0)]
# setup condition
condition_GW14 = cond.condition(con_set_GW14)
GW14_volt = extract_data(condition_GW14, m['IMIR_HK_GW14_POS_VOLT'])
returndata.update({'IMIR_HK_GW14_POS_VOLT': GW14_volt})
del condition_GW14
# extract data for IMIR_HK_GW23_POS_VOLT under given condition
con_set_GW23 = [ \
cond.greater(m['IMIR_HK_GW23_POS_VOLT'], 250.0)]