Skip to content

Commit

Permalink
The problem is in how I changed update_queue - the flatten().to_list(…
Browse files Browse the repository at this point in the history
…) bit applied to the queue type works fine with a single ObsID and a single or multiple expected output types, but it doesn't work with multiple ObsIDs because it still makes it completely flat rather than having one type entry (be it a string or an array) for each command. Adding some diagnostics to figure out the best solution
  • Loading branch information
DavidT3 committed Mar 1, 2025
1 parent 94169f3 commit 8e1a955
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions xga/generate/ciao/run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by David J Turner ([email protected]) 01/03/2025, 14:27. Copyright (c) The Contributors
# Last modified by David J Turner ([email protected]) 01/03/2025, 15:38. Copyright (c) The Contributors

from functools import wraps
from multiprocessing.dummy import Pool
Expand Down Expand Up @@ -52,7 +52,7 @@ def wrapper(*args, **kwargs):
all_path = [] # Combined expected path list for all sources
all_extras = [] # Combined extra information list for all sources
source_rep = [] # For repr calls of each source object, needed for assigning products to sources
print(len(cmd_list))

for ind in range(len(cmd_list)):
source = sources[ind]
if len(cmd_list[ind]) > 0:
Expand All @@ -68,6 +68,7 @@ def wrapper(*args, **kwargs):
# elegant solution but oh well).
if to_execute:
to_run, expected_type, expected_path, extras = source.get_queue()
print(expected_type)
all_run += to_run
all_type.append(expected_type)
all_path += expected_path
Expand Down
5 changes: 4 additions & 1 deletion xga/sources/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by David J Turner ([email protected]) 28/02/2025, 22:16. Copyright (c) The Contributors
# Last modified by David J Turner ([email protected]) 01/03/2025, 15:38. Copyright (c) The Contributors

import os
import pickle
Expand Down Expand Up @@ -2494,6 +2494,9 @@ def get_queue(self) -> Tuple[List[str], List[str], List[List[str]], List[dict]]:
extras = []
elif len(self.queue.shape) == 1 or self.queue.shape[1] <= 1:
processed_cmds = list(self.queue)

print(list(self.queue_type))

types = self.queue_type.flatten().tolist()
# The expected output paths can now be either a string or a list - hence the ternary logic
paths = [[path] if isinstance(path, str) else list(path) for path in self.queue_path]
Expand Down

0 comments on commit 8e1a955

Please sign in to comment.