Skip to content
Snippets Groups Projects

Improve fit

Merged Danilo Enoque Ferreira de Lima requested to merge parallelization into main
Files
4
@@ -8,7 +8,7 @@ import os
@@ -8,7 +8,7 @@ import os
import argparse
import argparse
import numpy as np
import numpy as np
from extra_data import open_run, by_id
from extra_data import open_run, by_id, RunDirectory
from pes_to_spec.model import Model, matching_two_ids
from pes_to_spec.model import Model, matching_two_ids
from itertools import product
from itertools import product
@@ -137,8 +137,10 @@ def main():
@@ -137,8 +137,10 @@ def main():
args = parser.parse_args()
args = parser.parse_args()
 
print("Opening run ...")
# get run
# get run
run = open_run(proposal=args.proposal, run=args.run)
run = open_run(proposal=args.proposal, run=args.run)
 
#run = RunDirectory("/gpfs/exfel/data/scratch/tmichela/data/r0206")
# ----------------Used in the first tests-------------------------
# ----------------Used in the first tests-------------------------
# get train IDs and match them, so we are sure to have information from all needed sources
# get train IDs and match them, so we are sure to have information from all needed sources
@@ -184,6 +186,8 @@ def main():
@@ -184,6 +186,8 @@ def main():
for ch in channels}
for ch in channels}
pes_raw_t = {ch: run[pes_name, f"digitizers.{ch}.raw.samples"].select_trains(by_id[test_tids]).ndarray()
pes_raw_t = {ch: run[pes_name, f"digitizers.{ch}.raw.samples"].select_trains(by_id[test_tids]).ndarray()
for ch in channels}
for ch in channels}
 
 
print("Data in memory.")
# read the XGM information
# read the XGM information
#xgm_pressure = run['SA3_XTD10_XGM/XGM/DOOCS', "pressure.pressureFiltered.value"].select_trains(by_id[tids]).ndarray()
#xgm_pressure = run['SA3_XTD10_XGM/XGM/DOOCS', "pressure.pressureFiltered.value"].select_trains(by_id[tids]).ndarray()
@@ -230,7 +234,7 @@ def main():
@@ -230,7 +234,7 @@ def main():
rmse = model.check_compatibility(pes_raw_t)
rmse = model.check_compatibility(pes_raw_t)
print("Consistency check RMSE ratios:", rmse)
print("Consistency check RMSE ratios:", rmse)
rmse = model.check_compatibility_per_channel(pes_raw_t)
rmse = model.check_compatibility_per_channel(pes_raw_t)
print("Consistency per channel check RMSE ratios:", rmse)
print("Consistency per channel check (chi2 - icdf(p=0.05))/ndof:", rmse)
t += [time_ns() - start]
t += [time_ns() - start]
t_names += ["Consistency"]
t_names += ["Consistency"]
@@ -253,7 +257,7 @@ def main():
@@ -253,7 +257,7 @@ def main():
spec_smooth = model.preprocess_high_res(spec_raw_int)
spec_smooth = model.preprocess_high_res(spec_raw_int)
first, last = model.get_low_resolution_range()
first, last = model.get_low_resolution_range()
first += 10
first += 10
last -= 100
last -= 10
pes_to_show = 'channel_1_D'
pes_to_show = 'channel_1_D'
# plot
# plot
for tid in test_tids:
for tid in test_tids:
Loading