|
12 | 12 | from numpy.random import Generator |
13 | 13 |
|
14 | 14 | from riid import SampleSet |
15 | | -from riid.data.synthetic.base import Synthesizer, get_distribution_values |
| 15 | +from riid.data.synthetic.base import (Synthesizer, get_distribution_values, |
| 16 | + set_ss_info_from_seed_info) |
16 | 17 |
|
17 | 18 |
|
18 | 19 | class PassbySynthesizer(Synthesizer): |
@@ -282,45 +283,16 @@ def generate(self, fg_seeds_ss: SampleSet, bg_seeds_ss: SampleSet, |
282 | 283 | fg_sources, bg_sources) |
283 | 284 | args.append(pb_args) |
284 | 285 |
|
285 | | - # TODO: follow prevents periodic progress reports |
| 286 | + # TODO: the following prevents periodic progress reports |
286 | 287 | passbys = [] |
287 | 288 | for a in args: |
288 | 289 | f, fwhm, snr, dwell_time, fg_pmf, bg_pmf, fg_sources, bg_sources = a |
289 | 290 | fg_passby_ss, gross_passby_ss = self._generate_single_passby( |
290 | 291 | fwhm, snr, dwell_time, fg_pmf, bg_pmf, fg_sources, bg_sources |
291 | 292 | ) |
292 | | - live_times = None |
293 | | - if fg_passby_ss is not None: |
294 | | - live_times = fg_passby_ss.info.live_time |
295 | | - elif gross_passby_ss is not None: |
296 | | - live_times = gross_passby_ss.info.live_time |
297 | | - else: |
298 | | - live_times = 1.0 |
299 | | - |
300 | | - fg_seed_ecal = fg_seeds_ss.ecal[f] |
301 | 293 | fg_seed_info = fg_seeds_ss.info.iloc[f] |
302 | | - batch_rt_targets = live_times * (1 - fg_seed_info.dead_time_prop) |
303 | | - fg_seed_distance_cm = fg_seed_info.distance_cm |
304 | | - fg_seed_dead_time_prop = fg_seed_info.dead_time_prop |
305 | | - fg_seed_ad = fg_seed_info.areal_density |
306 | | - fg_seed_an = fg_seed_info.atomic_number |
307 | | - fg_seed_neutron_counts = fg_seed_info.neutron_counts |
308 | | - |
309 | | - def _set_remaining_info(ss): |
310 | | - if ss is None: |
311 | | - return |
312 | | - ss: SampleSet = ss |
313 | | - ss.ecal = fg_seed_ecal |
314 | | - ss.info.real_time = batch_rt_targets |
315 | | - ss.info.distance_cm = fg_seed_distance_cm |
316 | | - ss.info.dead_time_prop = fg_seed_dead_time_prop |
317 | | - ss.info.areal_density = fg_seed_ad |
318 | | - ss.info.atomic_number = fg_seed_an |
319 | | - ss.info.neutron_counts = fg_seed_neutron_counts |
320 | | - ss.info.timestamp = self._synthesis_start_dt |
321 | | - |
322 | | - _set_remaining_info(fg_passby_ss) |
323 | | - _set_remaining_info(gross_passby_ss) |
| 294 | + set_ss_info_from_seed_info(fg_passby_ss, fg_seed_info, self._synthesis_start_dt) |
| 295 | + set_ss_info_from_seed_info(gross_passby_ss, fg_seed_info, self._synthesis_start_dt) |
324 | 296 |
|
325 | 297 | passbys.append((fg_passby_ss, gross_passby_ss)) |
326 | 298 |
|
|
0 commit comments