Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solvers-acuk-m
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Takhir Fakhrutdinov
solvers-acuk-m
Commits
6ac8e3b6
Commit
6ac8e3b6
authored
Oct 05, 2022
by
Takhir Fakhrutdinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Загрузка файлов ЕОР
parent
e7a84a82
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
12 deletions
+40
-12
3O9FTQCo-20220922_10350.json
fte/lib/libpy/data/3O9FTQCo-20220922_10350.json
+1
-1
msFile.py
fte/lib/libpy/msFile.py
+28
-1
eopfile.py
fte/lib/libpy/parsers/eopfile.py
+8
-7
xFile.py
fte/lib/libpy/xFile.py
+3
-3
No files found.
fte/lib/libpy/data/3O9FTQCo-20220922_10350.json
View file @
6ac8e3b6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
fte/lib/libpy/msFile.py
View file @
6ac8e3b6
...
...
@@ -4,6 +4,7 @@ import hashlib as hs
import
logging
import
json
import
io
import
sys
logger
=
logging
.
getLogger
(
''
)
...
...
@@ -50,7 +51,33 @@ class msFile(measFile):
if
_loaded
:
head
=
json
.
dumps
(
t
.
params
,
default
=
_2json
,
separators
=
(
','
,
':'
,))
_id
=
await
self
.
fetchval
(
"select * from nextval('xd.t_tracks_track_seq'::regclass)"
)
eop
=
t
.
eop
if
'eop'
in
t
.
_fileds
else
r'\N'
if
'eop'
in
t
.
_fields
:
# сохраняем имена файлов
async
with
self
.
transaction
():
await
self
.
execute
(
"""
insert into xd.t_nfstank(dev,night,fn)
select $1,$2,fn
from unnest($3::text[]) fn
on conflict do nothing
"""
,
dev
,
night
,
t
.
files
)
# получаем идентификаторы файлов
foid
=
await
self
.
fetchval
(
"""
with sf as (
select $1::integer dev,$2::date::timestamp night,fn,rn
from unnest($3::text[]) with ordinality v(fn,rn)
)
select array_agg(foid order by rn)
from xd.t_nfstank join sf using(dev,night,fn)
"""
,
dev
,
night
,
t
.
files
)
_
=
list
()
for
i
in
range
(
len
(
foid
)):
_
.
append
(
r'"({},\\"{}\\")"'
.
format
(
foid
[
i
],
json
.
dumps
(
t
.
eop
[
i
],
default
=
_2json
,
separators
=
(
','
,
':'
,))
.
replace
(
'"'
,
r'\\"\\"'
)))
eop
=
'{
%
s}'
%
','
.
join
(
_
)
else
:
eop
=
r'\N'
self
.
write
(
fo
,(
_id
,
t
.
tm
,
dev
,
vc
,
t
.
utr
,
t
.
meas
,
head
,
night
,
eop
))
tracks_crc
[
t
.
crc
]
=
dict
(
track
=
_id
,
tm
=
t
.
tm
)
else
:
...
...
fte/lib/libpy/parsers/eopfile.py
View file @
6ac8e3b6
...
...
@@ -12,7 +12,7 @@ track_list = {'sigma':float,'distrust':bool,'fake':bool}
bind_list
=
{
'time'
:
float
,
'id'
:
int
,
'along'
:
float
,
'across'
:
float
,
'dmag'
:
float
}
meas_list
=
{
'ra_j2000'
:
float
,
'dec_j2000'
:
float
,
'mag'
:
float
,
'ra_j2000_full_error'
:
float
,
'dec_j2000_full_error'
:
float
,
'mag_error'
:
float
,}
eop_list
=
{
'ra_j2000_error'
:
float
,
'dec_j2000_error'
:
float
,
'x'
:
float
,
'x_error'
:
float
,
'y'
:
float
,
'y_error'
:
float
,
'fwhm_x'
,
float
,
'fwhm_x_error'
:
float
,
'fwhm_y'
:
float
,
'fwhm_y_error'
:
float
,
'fwhm_x'
:
float
,
'fwhm_x_error'
:
float
,
'fwhm_y'
:
float
,
'fwhm_y_error'
:
float
,
'rot'
:
float
,
'snr'
:
float
,
'peak_snr'
:
float
,
'flux'
:
float
,
'ins_mag'
:
float
,
'aper_width'
:
float
,
'aper_height'
:
float
,
'channel'
:
float
,
'filter'
:
str
,
}
...
...
@@ -91,7 +91,7 @@ def _get_meas_t(meas):
mag
=
float
(
m
.
get
(
'mag'
,
0.0
))
if
mag
!=
0
:
mags
.
append
(
mag
)
eop
.
append
(
json
.
dumps
({
k
:
f
(
t
[
k
])
for
k
,
f
in
eop_list
.
items
()
if
k
in
t
and
t
.
get
(
k
)
is
not
None
})
)
eop
.
append
(
{
k
:
f
(
m
[
k
])
for
k
,
f
in
eop_list
.
items
()
if
k
in
m
and
m
.
get
(
k
)
is
not
None
}
)
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
,))
...
...
@@ -99,7 +99,7 @@ def _get_meas_t(meas):
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
return
tb
,
te
,
avg_m
,
'{
%
s}'
%
','
.
join
(
ms
),
files
,
'{
%
s}'
%
','
.
join
(
eop
)
return
tb
,
te
,
avg_m
,
'{
%
s}'
%
','
.
join
(
ms
),
files
,
eop
def
parsefile
(
f
):
tracks
,
tbeg
,
tend
,
mcnt
=
list
(),
datetime
.
max
,
datetime
.
min
,
0
...
...
@@ -108,21 +108,22 @@ def parsefile(f):
for
t
in
data
[
'tracks'
]:
if
not
siteid
:
siteid
=
t
[
'siteid'
]
b
=
t
.
get
(
'bind'
)
tb
,
te
,
avg_m
,
ms
,
files
,
eop
=
_get_meas_t
(
t
[
'meas'
])
tbeg
,
tend
,
cnt
=
min
(
tbeg
,
tb
),
max
(
tend
,
te
),
len
(
t
[
'meas'
])
mcnt
+=
cnt
# Формируем проводку
params
=
{
k
:
f
(
t
[
k
])
for
k
,
f
in
track_list
.
items
()
if
k
in
t
and
t
.
get
(
k
)
is
not
None
}
params
.
update
(
dict
(
bind
=
{
k
:
f
(
t
[
k
])
for
k
,
f
in
bind_list
.
items
()
if
k
in
t
and
t
.
get
(
k
)
is
not
None
}))
params
.
update
(
dict
(
bind
=
{
k
:
f
(
b
[
k
])
for
k
,
f
in
bind_list
.
items
()
if
k
in
b
and
b
.
get
(
k
)
is
not
None
}))
params
.
update
(
dict
(
cnt
=
cnt
,
mag
=
avg_m
,
obj
=
t
[
'trackid'
],
area
=
t
.
get
(
'target'
)))
tr
=
dict
(
tm
=
te
,
meas
=
ms
,
utr
=
'["
%
s","
%
s"]'
%
(
tb
,
te
,),
crc
=
_get_trackcrc
(
t
[
'meas'
]),
params
=
params
eop
=
eop
files
=
files
params
=
params
,
eop
=
eop
,
files
=
files
,
)
tracks
.
append
(
namedtuple
(
'track_t'
,
tr
.
keys
())(
**
tr
))
...
...
fte/lib/libpy/xFile.py
View file @
6ac8e3b6
...
...
@@ -161,9 +161,9 @@ class baseFile(Connection):
self
.
log
.
seek
(
0
)
self
.
fileattr
.
update
(
dict
(
log
=
self
.
log
.
read
(),
subj
=
self
.
args
.
subject
,
rem
=
self
.
args
.
comment
))
# Нужна внешняя транзакция
if
hasattr
(
self
,
'devs'
):
forecast
=
await
self
.
fetchval
(
self
.
FORECAST_SQL
,
self
.
devs
[
0
],
self
.
tbeg
)
self
.
fileattr
[
'wd'
]
=
forecast
#
if hasattr(self,'devs'):
#
forecast = await self.fetchval(self.FORECAST_SQL,self.devs[0],self.tbeg)
#
self.fileattr['wd'] = forecast
await
self
.
execute
(
"""
insert into main.t_files(fid,tm,state,ftype,usename,prefix,fname,crc,utr,tels,params)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment