diff --git a/tools/generate_features_slurm.py b/tools/generate_features_slurm.py index e66970e..0ccd9c8 100755 --- a/tools/generate_features_slurm.py +++ b/tools/generate_features_slurm.py @@ -59,7 +59,7 @@ def check_quads_for_sources( - fields: list = np.arange(1, 2001), + fields: list = np.arange(0, 2000), catalog: str = source_catalog, count_sources: bool = False, minobs: int = 0, @@ -87,6 +87,10 @@ def check_quads_for_sources( missing_ccd_quad = np.zeros(len(fields), dtype=bool) field_dct = {} + if save: + with open(BASE_DIR / f'{filename}.json', 'r') as f: + field_dct = json.load(f) + for idx, field in enumerate(fields): print('Running field %d' % int(field)) except_count = 0 @@ -165,14 +169,14 @@ def check_quads_for_sources( if except_count > 0: missing_ccd_quad[idx] = True + if save: + with open(BASE_DIR / f'{filename}.json', 'w') as f: + json.dump(field_dct, f) + print(f"Sources found in {np.sum(has_sources)} fields.") if count_sources: print(f"Found {running_total_sources} sources.") - if save: - with open(BASE_DIR / f'{filename}.json', 'w') as f: - json.dump(field_dct, f) - return field_dct, has_sources, missing_ccd_quad