Commit aa539bea authored by Takhir Fakhrutdinov's avatar Takhir Fakhrutdinov

Изменение подчёта контрольной суммы проводки

parent 3eb4047a
...@@ -301,7 +301,7 @@ eop = { ...@@ -301,7 +301,7 @@ eop = {
"mag_error":{"type":"string","pattern":r"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"}, "mag_error":{"type":"string","pattern":r"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"},
"crops":{"type":"string","media":{"binaryEncoding":"base64","type":"image/png"}} "crops":{"type":"string","media":{"binaryEncoding":"base64","type":"image/png"}}
}, },
"required": ["utc","ra_j2000","dec_j2000","mag","ra_j2000_full_error","dec_j2000_full_error","mag_error","crops"] "required": ["utc","ra_j2000","dec_j2000","mag","ra_j2000_full_error","dec_j2000_full_error","mag_error"]
} }
} }
} }
......
...@@ -48,7 +48,7 @@ def _get_trackcrc(meas): ...@@ -48,7 +48,7 @@ def _get_trackcrc(meas):
s = '' s = ''
for m in meas: for m in meas:
tm = datetime.strptime(m['utc'],'%d/%m/%Y %H:%M:%S.%f') tm = datetime.strptime(m['utc'],'%d/%m/%Y %H:%M:%S.%f')
t = '%s%.2f%.2f' % ( t = '%.22s%.2f%.2f' % (
tm.strftime('%Y-%m-%d %H:%M:%S.%f'), tm.strftime('%Y-%m-%d %H:%M:%S.%f'),
_hms(float( m['ra_j2000'])), _hms(float( m['ra_j2000'])),
_hms(float( m['dec_j2000'])), _hms(float( m['dec_j2000'])),
...@@ -78,10 +78,14 @@ def _get_meas_t(meas): ...@@ -78,10 +78,14 @@ def _get_meas_t(meas):
tm = datetime.strptime(m['utc'],'%d/%m/%Y %H:%M:%S.%f') tm = datetime.strptime(m['utc'],'%d/%m/%Y %H:%M:%S.%f')
tb,te = min(tb,tm),max(te,tm) tb,te = min(tb,tm),max(te,tm)
rec = [float(m.get(i,0.0)) for i in (_fields)] rec = [float(m.get(i,0.0)) for i in (_fields)]
crops = r'\\\\\\\\x%s' % base64.b64decode(m['crops']).hex()
mag = float(m.get('mag',0.0)) mag = float(m.get('mag',0.0))
if mag != 0: mags.append(mag) if mag != 0: mags.append(mag)
if 'crops' in m:
crops = r'\\\\\\\\x%s' % base64.b64decode(m['crops']).hex()
ms.append(r'"(\\"%s\\",\\"%s\\",\\"%s\\")"' % (tm.isoformat(),str(rec).replace('[','{').replace(']','}'),crops,)) ms.append(r'"(\\"%s\\",\\"%s\\",\\"%s\\")"' % (tm.isoformat(),str(rec).replace('[','{').replace(']','}'),crops,))
else:
ms.append(r'"(\\"%s\\",\\"%s\\",)"' % (tm.isoformat(),str(rec).replace('[','{').replace(']','}'),))
avg_m = round(sum(mags)/len(mags),1) if len(mags) else 0.0 avg_m = round(sum(mags)/len(mags),1) if len(mags) else 0.0
return tb,te,avg_m,'{'+','.join(ms)+'}' return tb,te,avg_m,'{'+','.join(ms)+'}'
......
...@@ -47,7 +47,7 @@ def get_trackcrc(meas): ...@@ -47,7 +47,7 @@ def get_trackcrc(meas):
""" """
s = '' s = ''
for m in meas: for m in meas:
t = '%s%.2f%.2f' % (m.tm.strftime('%Y-%m-%d %H:%M:%S.%f'),m.params[0],m.params[1],) t = '%.22s%.2f%.2f' % (m.tm.strftime('%Y-%m-%d %H:%M:%S.%f'),m.params[0],m.params[1],)
s += t s += t
return hs.md5(s.encode('utf8')).hexdigest() return hs.md5(s.encode('utf8')).hexdigest()
......
...@@ -54,7 +54,7 @@ def get_trackcrc(meas): ...@@ -54,7 +54,7 @@ def get_trackcrc(meas):
""" """
s = '' s = ''
for m in meas: for m in meas:
t = '%s%.2f%.2f' % (m.tm.strftime('%Y-%m-%d %H:%M:%S.%f'),m.params[0],m.params[1],) t = '%.22s%.2f%.2f' % (m.tm.strftime('%Y-%m-%d %H:%M:%S.%f'),m.params[0],m.params[1],)
s += t s += t
return hs.md5(s.encode('utf8')).hexdigest() return hs.md5(s.encode('utf8')).hexdigest()
......
...@@ -48,7 +48,7 @@ def _get_trackcrc(meas,is_degree): ...@@ -48,7 +48,7 @@ def _get_trackcrc(meas,is_degree):
s = '' s = ''
for m in meas: for m in meas:
tm = datetime.fromisoformat(m[0]) tm = datetime.fromisoformat(m[0])
t = '%s%.2f%.2f' % ( t = '%.22s%.2f%.2f' % (
tm.strftime('%Y-%m-%d %H:%M:%S.%f'), tm.strftime('%Y-%m-%d %H:%M:%S.%f'),
_hms(float( m[1]/15.0 )) if is_degree else float( m[1] ), # Переводим в часовой угол _hms(float( m[1]/15.0 )) if is_degree else float( m[1] ), # Переводим в часовой угол
_hms(float( m[2] )) if is_degree else float( m[2] ), _hms(float( m[2] )) if is_degree else float( m[2] ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment