Commit 4ac339a1 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

fixed n_file_expected bug for obs_group-detector dispatcher

parent a9114d21
...@@ -543,7 +543,7 @@ class Dispatcher: ...@@ -543,7 +543,7 @@ class Dispatcher:
return [] return []
# unique obsgroup basis (using group_by) # unique obsgroup basis (using group_by)
obsgroup_basis = plan_basis.group_by( obsgroup_plan_basis = plan_basis.group_by(
keys=[ keys=[
"dataset", "dataset",
"instrument", "instrument",
...@@ -556,29 +556,29 @@ class Dispatcher: ...@@ -556,29 +556,29 @@ class Dispatcher:
task_list = [] task_list = []
# loop over obsgroup # loop over obsgroup
for i_obsgroup in trange(len(obsgroup_basis.groups), **TQDM_KWARGS): for i_obsgroup_plan in trange(len(obsgroup_plan_basis.groups), **TQDM_KWARGS):
this_obsgroup_basis = obsgroup_basis.groups[i_obsgroup] this_obsgroup_plan_basis = obsgroup_plan_basis.groups[i_obsgroup_plan]
this_obsgroup_obsid = this_obsgroup_basis["obs_id"].data this_obsgroup_obsid = this_obsgroup_plan_basis["obs_id"].data
n_file_expected = this_obsgroup_basis["n_file"].sum() n_file_expected = len(this_obsgroup_obsid)
this_instrument = this_obsgroup_basis["instrument"][0] this_instrument = this_obsgroup_plan_basis["instrument"][0]
effective_detector_names = csst[this_instrument].effective_detector_names effective_detector_names = csst[this_instrument].effective_detector_names
for this_effective_detector_name in effective_detector_names: for this_effective_detector_name in effective_detector_names:
this_task = dict( this_task = dict(
dataset=this_obsgroup_basis["dataset"][0], dataset=this_obsgroup_plan_basis["dataset"][0],
instrument=this_obsgroup_basis["instrument"][0], instrument=this_obsgroup_plan_basis["instrument"][0],
obs_type=this_obsgroup_basis["obs_type"][0], obs_type=this_obsgroup_plan_basis["obs_type"][0],
obs_group=this_obsgroup_basis["obs_group"][0], obs_group=this_obsgroup_plan_basis["obs_group"][0],
detector=this_effective_detector_name, detector=this_effective_detector_name,
) )
this_obsgroup_detector_expected = table.Table( this_obsgroup_detector_expected = table.Table(
[ [
dict( dict(
dataset=this_obsgroup_basis["dataset"][0], dataset=this_obsgroup_plan_basis["dataset"][0],
instrument=this_obsgroup_basis["instrument"][0], instrument=this_obsgroup_plan_basis["instrument"][0],
obs_type=this_obsgroup_basis["obs_type"][0], obs_type=this_obsgroup_plan_basis["obs_type"][0],
obs_group=this_obsgroup_basis["obs_group"][0], obs_group=this_obsgroup_plan_basis["obs_group"][0],
obs_id=this_obsid, obs_id=this_obsid,
detector=this_effective_detector_name, detector=this_effective_detector_name,
) )
...@@ -610,9 +610,9 @@ class Dispatcher: ...@@ -610,9 +610,9 @@ class Dispatcher:
dict( dict(
task=this_task, task=this_task,
success=this_success, success=this_success,
relevant_plan=this_obsgroup_basis, relevant_plan=this_obsgroup_plan_basis,
relevant_data=this_obsgroup_detector_found, relevant_data=this_obsgroup_detector_found,
n_relevant_plan=len(this_obsgroup_basis), n_relevant_plan=len(this_obsgroup_plan_basis),
n_relevant_data=len(this_obsgroup_detector_found), n_relevant_data=len(this_obsgroup_detector_found),
relevant_data_id_list=( relevant_data_id_list=(
list(this_obsgroup_detector_found["_id"]) list(this_obsgroup_detector_found["_id"])
......
Supports Markdown
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