Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CCS
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marko Mecina
CCS
Compare revisions
f8177e6042eb7f0588e824774693a0ac9266c2f5 to 6cf0e20339cdaa7751b827d041cf26ac1c4af8dc
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
mecinam2/ccs
Select target project
No results found
6cf0e20339cdaa7751b827d041cf26ac1c4af8dc
Select Git revision
Branches
release
workshop
2 results
Swap
Target
mecinam2/ccs
Select target project
mecinam2/ccs
1 result
f8177e6042eb7f0588e824774693a0ac9266c2f5
Select Git revision
Branches
release
workshop
2 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (4)
remove deprecated variable packet decoding functions
· e64006d9
Marko Mecina
authored
5 months ago
e64006d9
add CUC to date-object function
· 0c822818
Marko Mecina
authored
5 months ago
0c822818
change CCD temp calculation
· 145c654f
Marko Mecina
authored
5 months ago
145c654f
add look-up table for evtLimitList array indices
· 6cf0e203
Marko Mecina
authored
5 months ago
6cf0e203
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Ccs/calibrations_SMILE.py
+113
-2
113 additions, 2 deletions
Ccs/calibrations_SMILE.py
Ccs/ccs_function_lib.py
+14
-100
14 additions, 100 deletions
Ccs/ccs_function_lib.py
with
127 additions
and
102 deletions
Ccs/calibrations_SMILE.py
View file @
6cf0e203
...
...
@@ -261,8 +261,10 @@ POLY_DEG = 4
_ccd_temp_adu_array
=
np
.
array
(
CCD_TEMP_TABLE
).
T
# (degC, ADC_V, ADU_dec, ADU_hex)
_ccd_temp_fit_adu
=
np
.
polynomial
.
polynomial
.
Polynomial
.
fit
(
_ccd_temp_adu_array
[
2
],
_ccd_temp_adu_array
[
0
],
POLY_DEG
).
convert
()
_ccd_temp_fit_adu_inv
=
np
.
polynomial
.
polynomial
.
Polynomial
.
fit
(
_ccd_temp_adu_array
[
0
],
_ccd_temp_adu_array
[
2
],
POLY_DEG
).
convert
()
_ccd_temp_interp_adu
=
sp
.
interpolate
.
interp1d
(
_ccd_temp_adu_array
[
2
],
_ccd_temp_adu_array
[
0
],
kind
=
'
cubic
'
,
fill_value
=
'
extrapolate
'
)
# _ccd_temp_fit_adu_inv = np.polynomial.polynomial.Polynomial.fit(_ccd_temp_adu_array[0], _ccd_temp_adu_array[2],
# POLY_DEG).convert()
_ccd_temp_interp_adu_inv
=
sp
.
interpolate
.
interp1d
(
_ccd_temp_adu_array
[
0
],
_ccd_temp_adu_array
[
2
],
kind
=
'
cubic
'
,
fill_value
=
'
extrapolate
'
)
...
...
@@ -1056,6 +1058,115 @@ class RowColCorrection:
self
.
ccd2_f_cols
=
self
.
_col_corr
[
3
::
4
]
class
EvtIds
:
_evt_dict
=
{
"
EVT_MEM_COR_RAM
"
:
256
,
"
EVT_MEM_UNCOR_RAM
"
:
257
,
"
EVT_MEM_UNCOR_MRAM
"
:
258
,
"
EVT_MEM_LOAD_CMP
"
:
259
,
"
EVT_PARLOAD_CMP
"
:
260
,
"
EVT_ADC_LOGIC
"
:
272
,
"
EVT_ADC_FAILURE
"
:
273
,
"
EVT_ADC_NORANGES
"
:
274
,
"
EVT_DPU_VOLT_WARN
"
:
275
,
"
EVT_DPU_TEMP_WARN
"
:
276
,
"
EVT_DPU_PERM_WARN
"
:
277
,
"
EVT_DPU_VOLT_FAIL
"
:
278
,
"
EVT_DPU_TEMP_FAIL
"
:
279
,
"
EVT_DPU_PERM_FAIL
"
:
280
,
"
EVT_SPW_RXTO
"
:
288
,
"
EVT_SPW_TXTO
"
:
289
,
"
EVT_SPW_CONTO
"
:
290
,
"
EVT_SPW_PARITY
"
:
291
,
"
EVT_SPW_DISCONNECT
"
:
292
,
"
EVT_SPW_ESCAPE
"
:
293
,
"
EVT_SPW_CREDIT
"
:
294
,
"
EVT_SPW_RXAHB
"
:
295
,
"
EVT_SPW_TXAHB
"
:
296
,
"
EVT_SPW_EARLYEOP
"
:
297
,
"
EVT_SPW_INVADDR
"
:
298
,
"
EVT_SPW_EEP
"
:
299
,
"
EVT_SPW_TOOBIG
"
:
300
,
"
EVT_RSE_PARITY
"
:
304
,
"
EVT_RSE_FRAME
"
:
305
,
"
EVT_RSE_ERRRESP
"
:
306
,
"
EVT_RSE_TIMEOUT
"
:
307
,
"
EVT_RSE_MOTORHOT
"
:
308
,
"
EVT_RSE_ELECHOT
"
:
309
,
"
EVT_RSE_CLOSE_TO
"
:
310
,
"
EVT_RSE_NOCOM
"
:
311
,
"
EVT_RSE_NOPARAM
"
:
312
,
"
EVT_PSU_CURR_WARN
"
:
320
,
"
EVT_PSU_TEMP_WARN
"
:
321
,
"
EVT_PSU_PERM_WARN
"
:
322
,
"
EVT_PSU_CURR_FAIL
"
:
323
,
"
EVT_PSU_TEMP_FAIL
"
:
324
,
"
EVT_PSU_PERM_FAIL
"
:
325
,
"
EVT_PSU_PSUOK_ERR
"
:
326
,
"
EVT_PSU_RSEOK_ERR
"
:
327
,
"
EVT_PSU_PSUOK_PERM
"
:
328
,
"
EVT_PSU_RSEOK_PERM
"
:
329
,
"
EVT_CMD_INV_APID
"
:
336
,
"
EVT_FEE_TR
"
:
768
,
"
EVT_IASW_TR
"
:
769
,
"
EVT_SC_PR_STRT
"
:
770
,
"
EVT_SC_PR_END
"
:
771
,
"
EVT_INIT_SUCC
"
:
772
,
"
EVT_SEQ_CNT_ERR
"
:
784
,
"
EVT_SBIT_ERR
"
:
785
,
"
EVT_FEE_DATA_ERR
"
:
786
,
"
EVT_PCRL2_FULL
"
:
800
,
"
EVT_INSTRM_PQF
"
:
801
,
"
EVT_IN_ILLGR
"
:
802
,
"
EVT_DBIT_ERR
"
:
803
,
"
EVT_SYNC_LOSS
"
:
804
,
"
EVT_FD_FAILED
"
:
805
,
"
EVT_CMPR_SIZE
"
:
806
,
"
EVT_SDP_FAIL
"
:
807
,
"
EVT_SDP_NOMEM
"
:
808
,
"
EVT_SDP_DATAFAIL
"
:
809
,
"
EVT_FEE_ILL_ST
"
:
810
,
"
EVT_INIT_FAIL
"
:
816
,
"
EVT_THRD_OR
"
:
817
,
"
EVT_NOTIF_ERR
"
:
818
,
"
EVT_SPW_ERR_H
"
:
819
,
"
EVT_RP_STARTED
"
:
820
,
"
EVT_MEM_COR_MRAM
"
:
261
,
"
EVT_MEM_MRAM_LCL
"
:
262
,
"
EVT_ADC_OUT_OF_RANGE
"
:
281
,
"
EVT_HCTRL_NOPARAM
"
:
811
,
"
EVT_FEE_TEMP_WARN
"
:
821
,
"
EVT_CCD_TEMP_WARN
"
:
822
,
"
EVT_FEE_TEMP_FAIL
"
:
823
,
"
EVT_CCD_TEMP_FAIL
"
:
824
,
"
EVT_FEE_NOT_ALIVE
"
:
826
,
"
EVT_FEE_ANOMALY
"
:
827
,
"
EVT_FEE_ANO_FAIL
"
:
828
,
"
EVT_FEE_PARAM_OOL
"
:
829
,
"
EVT_RES_ERR
"
:
830
,
"
EVT_FULL_SUN
"
:
831
,
"
EVT_FULL_SUN_FAIL
"
:
832
,
"
EVT_FEE_EC_SAT
"
:
833
,
"
EVT_FEE_EC_RATE
"
:
834
,
"
EVT_DPU_EC_SAT
"
:
835
,
"
EVT_DPU_EC_RATE
"
:
836
,
"
EVT_FEE_CCD_TEMP_FAIL
"
:
825
,
"
EVT_DOOR_OPER_TO
"
:
837
,
"
EVT_FEE_PARAM_WARN
"
:
838
}
evts
=
list
(
_evt_dict
.
keys
())
@classmethod
def
get_idx
(
cls
,
evt
):
return
cls
.
evts
.
index
(
evt
)
@classmethod
def
get_evtid
(
cls
,
evt
):
return
cls
.
_evt_dict
.
get
(
evt
)
if
__name__
==
'
__main__
'
:
import
matplotlib.pyplot
as
plt
...
...
This diff is collapsed.
Click to expand it.
Ccs/ccs_function_lib.py
View file @
6cf0e203
...
...
@@ -74,11 +74,11 @@ pc = importlib.import_module(PCPREFIX + str(project).upper())
# project specific parameters, must be present in all packet_config_* files
try:
PUS_VERSION, TMHeader, TCHeader, PHeader, TM_HEADER_LEN, TC_HEADER_LEN, P_HEADER_LEN, PEC_LEN, MAX_PKT_LEN, timepack, \
timecal, calc_timestamp, CUC_OFFSET, CUC_EPOCH, crc, PLM_PKT_PREFIX_TC_SEND, PLM_PKT_SUFFIX
, FMT_TYPE_PARAM
= \
timecal, calc_timestamp, CUC_OFFSET, CUC_EPOCH, crc, PLM_PKT_PREFIX_TC_SEND, PLM_PKT_SUFFIX = \
[pc.PUS_VERSION, pc.TMHeader, pc.TCHeader, pc.PHeader,
pc.TM_HEADER_LEN, pc.TC_HEADER_LEN, pc.P_HEADER_LEN, pc.PEC_LEN,
pc.MAX_PKT_LEN, pc.timepack, pc.timecal, pc.calc_timestamp,
pc.CUC_OFFSET, pc.CUC_EPOCH, pc.puscrc, pc.PLM_PKT_PREFIX_TC_SEND, pc.PLM_PKT_SUFFIX
, pc.FMT_TYPE_PARAM
]
pc.CUC_OFFSET, pc.CUC_EPOCH, pc.puscrc, pc.PLM_PKT_PREFIX_TC_SEND, pc.PLM_PKT_SUFFIX]
s13_unpack_data_header = pc.s13_unpack_data_header
SPW_PROTOCOL_IDS_R = {pc.SPW_PROTOCOL_IDS[key]: key for key in pc.SPW_PROTOCOL_IDS}
...
...
@@ -1312,6 +1312,17 @@ def cuc_to_utc(cuc):
return utc.isoformat()
def cuc_to_date(cuc):
"""
Returns datetime object of the provided second offset from the reference epoch
:param cuc:
:return:
"""
return CUC_EPOCH + datetime.timedelta(seconds=cuc)
def cuc_time_str(head, logger=logger):
"""
Return PUS header timestamp as string
...
...
@@ -1531,59 +1542,6 @@ def prettyhex(inbytes, separator=' '):
return separator.join(['%02X' % x for x in inbytes])
##
# Varpack
#
# Decode variable-length part of TM/TC source data
# @param data input data of bitstring.BitStream type
# @param parameters list of parameter properties present in data
# @param paramid parameter counter
# @param outlist list of decoded source data parameter values
# @param parlist list of decoded source data parameter properties
def read_varpack(data, parameters, paramid, outlist, parlist):
"""
:param data:
:param parameters:
:param paramid:
:param outlist:
:param parlist:
:return:
"""
while paramid < len(parameters):
fmt = ptt(parameters[paramid][2], parameters[paramid][3])
if parameters[paramid][2] == 11: # TODO: handle deduced parameter types
raise NotImplementedError('Deduced parameter type PTC=11')
# fmt = fmt[ptype]
# if ptype == 7: # ptt fmt string for bool not parsable with .read
# fmt = 'uint8'
outdata = data.read(fmt)
grpsize = parameters[paramid][-2]
if parameters[paramid][6] == FMT_TYPE_PARAM:
ptype = outdata
outlist.append(outdata)
parlist.append(parameters[paramid])
if grpsize == 0:
paramid += 1
else:
if parlist[-1][-1] == 0:
repeat = outlist[-1]
else:
repeat = parlist[-1][-1]
data.pos -= parlist[-1][5]
# delete counter entry from lists
outlist.pop(-1)
parlist.pop(-1)
while repeat > 0:
outlist, parlist = read_varpack(data, parameters[paramid + 1:paramid + grpsize + 1], 0,
outlist, parlist)
repeat -= 1
paramid += grpsize + 1
return outlist, parlist
def read_variable_pckt(tm_data, parameters, tc=False):
"""
Read parameters from a variable length packet
...
...
@@ -2186,7 +2144,7 @@ def get_param_values(tmlist=None, hk=None, param=None, last=0, numerical=False,
if tmlist is None and pool_name is not None:
tmlist = get_pool_rows(pool_name, check_existence=True)
dbcon = scoped_session_idb
()
dbcon = scoped_session_idb
if hk is None:
que = 'SELECT plf.plf_name,plf.plf_spid,plf.plf_offby,plf.plf_offbi,pcf.pcf_ptc,pcf.pcf_pfc,pcf.pcf_unit,\
pcf.pcf_descr,pid.pid_apid,pid.pid_type,pid.pid_stype,pid.pid_descr,pid.pid_pi1_val from pcf\
...
...
@@ -3305,50 +3263,6 @@ def PUSpack(version=0, typ=0, dhead=0, apid=0, gflags=0b11, sc=0, pktl=0,
return bytes(header.bin) + data
##
# Build Packstring 11
#
# Create pack string if datatypes are defined in the packet iti.e. PTC/PTF=11/0
# @param st Service type
# @param sst Service sub-tpye
# @param apid APID of TC
# @param params List of parameter properties
# @param varpos Position of the parameter indicating repetition
# @param grpsize Parameter group size
# @param repfac Number of parameter (group) repetitions
# def build_packstr_11(st, sst, apid, params, varpos, grpsize, repfac, *args, no_check=False):
# """
#
# :param st:
# :param sst:
# :param apid:
# :param params:
# :param varpos:
# :param grpsize:
# :param repfac:
# :param args:
# :param no_check:
# :return:
# """
# ptypeindex = [i[-1] == FMT_TYPE_PARAM for i in params].index(True) # check where fmt type defining parameter is
# ptype = args[varpos + ptypeindex::grpsize]
# args2 = list(args)
# args2[varpos + 1:] = [tc_param_alias(param[-1], val, no_check=no_check) for param, val in
# zip(params[varpos + 1:] * repfac, args[varpos + 1:])]
# ptc = 0
# varlist = []
# for par in params[varpos + 1:] * repfac:
# if par[-4] != 11:
# #varlist.append(ptt[par[-4]][par[-3]])
# varlist.append(parameter_ptt_type_tc(par))
# else:
# varlist.append(
# ptt(par[-4], par[-3])[tc_param_alias(FMT_TYPE_PARAM, ptype[ptc], no_check=no_check)])
# #varlist.append(ptt[par[-4]][par[-3]][tc_param_alias('DPP70044', ptype[ptc], no_check=no_check)])
# ptc += 1
# return varlist, args2
##
# TC send (common part of Tcsend_DB and Tcsend)
#
...
...
This diff is collapsed.
Click to expand it.