Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
calibration
pycalibration
Commits
32164d00
"README.md" did not exist on "0561212aa67facbb78f0f7cc97de6a77f5e84f2e"
Commit
32164d00
authored
6 years ago
by
Mikhail Karnevskiy
Browse files
Options
Downloads
Patches
Plain Diff
include more statisticcs information
parent
656be091
No related branches found
No related tags found
1 merge request
!12
Study statistics
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notebooks/LPD/PlotFromCalDB.py
+51
-30
51 additions, 30 deletions
notebooks/LPD/PlotFromCalDB.py
with
51 additions
and
30 deletions
notebooks/LPD/PlotFromCalDB.py
+
51
−
30
View file @
32164d00
...
...
@@ -20,7 +20,7 @@ warnings.filterwarnings('ignore')
matplotlib
.
use
(
"
agg
"
)
start_date
=
"
2018-0
7
-25
"
# date to start investigation interval from
start_date
=
"
2018-0
6
-25
"
# date to start investigation interval from
end_date
=
"
now
"
# date to end investigation interval at, can be "now"
interval
=
3
# interval for evaluation in days
detector
=
"
LPD1M1
"
# detector to investigate
...
...
@@ -105,7 +105,7 @@ while dt < end:
if
cdata
is
not
None
:
carr
=
np
.
zeros
((
5
,
max_cells
,
3
))
carr_glob
=
np
.
zeros
((
5
,
3
))
carr_
rad
=
np
.
zeros
((
cdata
.
shape
[
0
],
max_cells
,
3
))
carr_
px
=
np
.
zeros
((
cdata
.
shape
[
0
],
max_cells
,
3
,
2
))
for
g
in
range
(
3
):
td
=
np
.
nanmean
(
cdata
[...,
g
],
axis
=
(
0
,
1
))
print
(
td
.
shape
)
...
...
@@ -138,9 +138,11 @@ while dt < end:
td
=
np
.
nanstd
(
cdata
[...,
g
])
carr_glob
[
3
,
g
]
=
td
carr_rad
[...,
g
]
=
np
.
nanmedian
(
cdata
[...,
g
],
axis
=
0
)
carr_px
[...,
g
,
0
]
=
np
.
nanmedian
(
cdata
[...,
g
],
axis
=
0
)
carr_px
[...,
g
,
1
]
=
np
.
nanmedian
(
cdata
[...,
g
],
axis
=
1
)
ret_constants
[
const
][
qm
].
append
((
creation_time
,(
carr
,
carr_glob
,
carr_rad
)))
ret_constants
[
const
][
qm
].
append
((
creation_time
,
(
carr
,
carr_glob
,
carr_px
)))
dt
+=
step
...
...
@@ -167,41 +169,24 @@ for const, modules in ret_constants.items():
pmm
,
glob
,
_
=
list
(
zip
(
*
cd
))
pma
=
np
.
array
(
pmm
)
ga
=
np
.
array
(
glob
)
d
=
pma
[:,
typ
,:,:]
print
(
pma
.
shape
,
ga
.
shape
,
d
.
shape
)
if
np
.
allclose
(
d
,
0
):
continue
x
=
[]
y
=
[]
hue
=
[]
# loop over gain
for
g
in
range
(
3
):
dd
=
(
pma
[:,
typ
,:,
g
]
-
pma
[
0
,
typ
,:,
g
])
/
pma
[
0
,
typ
,:,
g
]
print
(
pma
[
0
,
typ
,:,
g
])
dd
[
~
np
.
isfinite
(
dd
)]
=
0
x
.
append
(
np
.
repeat
(
np
.
array
(
ctimes
)[:,
None
],
dd
.
shape
[
1
],
axis
=
1
).
flatten
())
print
(
x
)
y
.
append
(
dd
.
flatten
())
hue
.
append
(
np
.
ones
(
dd
.
shape
).
flatten
()
*
g
)
x
=
np
.
concatenate
(
x
)
y
=
np
.
concatenate
(
y
)
hue
=
np
.
concatenate
(
hue
)
print
(
x
.
shape
)
dd
=
pma
[:,
typ
,:,:]
#-pma[0,typ,:,:])/pma[0,typ,:,:]
y
=
dd
.
flatten
()
x
=
np
.
repeat
(
np
.
array
(
ctimes
)[:,
None
],
dd
[
0
,:,:].
size
,
axis
=
1
).
flatten
()
hue
=
np
.
repeat
(
np
.
array
([
'
gain 0
'
,
'
gain 1
'
,
'
gain 2
'
])[:,
None
],
dd
[:,:,
0
].
size
,
axis
=
1
).
swapaxes
(
0
,
1
).
flatten
()
seaborn
.
violinplot
(
x
,
y
,
hue
,
scale
=
"
width
"
,
dodge
=
False
,
saturation
=
0.7
)
#for i in range(max_cells):
#ax.scatter(ctimes, (pma[:,typ,i,g]-pma[0,typ,i,g])/pma[0,typ,i,g], marker='.', color=colors[g], alpha=0.5)
#ax.plot(ctimes, (ga[:,typ,g]-ga[0,typ,g])/ga[0,typ,g], color=colors[g], alpha=0.5)
ax
.
set_ylim
(
-
0.25
,
.
25
)
#ax.set_ylim(-0.25, .25)
if
typ
!=
len
(
types
)
-
1
:
ax
.
axes
.
get_xaxis
().
set_visible
(
False
)
else
:
def
format_date
(
x
,
pos
=
None
):
return
ctimes
[
x
].
strftime
(
'
%d-%m
'
)
ax
.
xaxis
.
set_major_formatter
(
ticker
.
FuncFormatter
(
format_date
))
ax
.
set_xlabel
(
"
Date
"
)
...
...
@@ -211,5 +196,41 @@ for const, modules in ret_constants.items():
plt
.
subplots_adjust
(
wspace
=
0.2
,
hspace
=
0.2
)
if
out_folder
!=
""
:
fig
.
savefig
(
"
{}/{}_time_development.pdf
"
.
format
(
out_folder
,
const
),
bbox_inches
=
'
tight
'
)
fig
.
savefig
(
"
{}/{}_time_development.pdf
"
.
format
(
out_folder
,
const
),
bbox_inches
=
'
tight
'
)
plt
.
show
()
fig
=
plt
.
figure
(
figsize
=
(
15
,
7
))
ax
=
plt
.
subplot2grid
((
1
,
1
),
(
0
,
0
))
# loop over modules
for
mod
,
data
in
modules
.
items
():
ctimes
,
cd
=
list
(
zip
(
*
data
))
_
,
_
,
px
=
list
(
zip
(
*
cd
))
px
=
np
.
array
(
px
)
print
(
px
.
shape
)
y
=
px
[:,:,
5
,
0
,:].
flatten
()
x
=
np
.
repeat
(
np
.
array
(
ctimes
)[:,
None
],
px
[
0
,:,
5
,
0
,:].
size
,
axis
=
1
).
flatten
()
hue
=
np
.
repeat
(
np
.
array
([
'
px
'
,
'
py
'
])[:,
None
],
px
[:,:,
5
,
0
,
0
].
size
,
axis
=
1
).
swapaxes
(
0
,
1
).
flatten
()
seaborn
.
violinplot
(
x
,
y
,
hue
,
palette
=
"
muted
"
,
split
=
True
)
def
format_date
(
x
,
pos
=
None
):
return
ctimes
[
x
].
strftime
(
'
%d-%m
'
)
ax
.
xaxis
.
set_major_formatter
(
ticker
.
FuncFormatter
(
format_date
))
ax
.
set_xlabel
(
"
Date
"
)
ax
.
set_ylabel
(
"
Median over pixels
"
)
plt
.
subplots_adjust
(
wspace
=
0.2
,
hspace
=
0.2
)
if
out_folder
!=
""
:
fig
.
savefig
(
"
{}/{}_pxtime_development.pdf
"
.
format
(
out_folder
,
const
),
bbox_inches
=
'
tight
'
)
plt
.
show
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment