Skip to content

Commit ebbf8bf

Browse files
changed answering PR report
1 parent 110cd2b commit ebbf8bf

File tree

9 files changed

+23
-29
lines changed

9 files changed

+23
-29
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors = [
99
{ name = "Martin Kilbinger", email = "martin.kilbinger@cea.fr" }
1010
]
1111
license = { "file" = "LICENSE" }
12-
requires-python = ">=3.10"
12+
requires-python = ">=3.11"
1313
dependencies = [
1414
"joblib>=0.13",
1515
"modopt>=1.2",

scripts/python/clear_ngmix_prev.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def main():
112112
else:
113113
n_objects, n_hdus = (-1, -1)
114114

115-
# File info of new
115+
# File info of prev
116116
prev_out_dir = prev_dir / "output"
117-
fits_files = list(ngmix_out_dir.glob("ngmix-*.fits"))
117+
fits_files = list(prev_out_dir.glob("ngmix-*.fits"))
118118
if fits_files:
119119
for fits_file in fits_files:
120120
n_objects_prev, n_hdus_prev = get_fits_info(fits_file)

scripts/python/distribute_tiles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/arc/home/kilbinger/.conda/envs/shapepipe/bin/python3.10
1+
#!/usr/bin/env python
22
"""
33
distribute_tiles.py
44
@@ -121,7 +121,7 @@ def build_process_command(tile_id, original_args):
121121
elif original_args[i] in ('--batch_num', '--batch_tot', '--batch_size', '--parallel_jobs'):
122122
i += 2
123123
elif original_args[i] in ('-n', '--dry_run'):
124-
if original_args[i] in (0, 1):
124+
if original_args[i] in ("0", "1"):
125125
cmd.extend(["-n", original_args[i]])
126126
i += 2
127127
else:

src/shapepipe/canfar/canfar_monitor.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# canfar_monitor.py
22

3-
# Montiot job submitted with the canfar client
3+
# Montior job submitted with the canfar client
44

55
import os
66
import sys
@@ -127,7 +127,7 @@ def filter(self):
127127
df['time'] = '12:04:00'
128128
except Exception as e:
129129
estr = f": {e}" if self._params["verbose"] else ""
130-
raise RunTimeError(
130+
raise RuntimeError(
131131
f"An error occurred while processing dates: {estr}"
132132
) from e
133133

@@ -185,7 +185,7 @@ def destroy(self, df, session):
185185
bulk = self._params["bulk"]
186186

187187
if bulk == 2:
188-
kind = self._get_kind()
188+
kind = self.get_kind()
189189

190190
if self._params["status"] != "all":
191191
status = self._params["status"]
@@ -202,10 +202,6 @@ def destroy(self, df, session):
202202
except Exception as e:
203203
if self._params.get("verbose"):
204204
print(f"Failed to destroy jobs: {e}")
205-
else:
206-
print("Failed to destroy jobs")
207-
# Optionally exit or return gracefully
208-
return False
209205

210206
print("Success")
211207
return
@@ -219,7 +215,7 @@ def destroy(self, df, session):
219215
print(f"{len(ids)} sessions done")
220216
except Exception as e:
221217
estr = f": {e}" if self._params["verbose"] else ""
222-
print("failed{estr}")
218+
print(f"failed{estr}")
223219

224220
else:
225221
print("Loop destroy")
@@ -232,7 +228,7 @@ def destroy(self, df, session):
232228
print(f"{result[session_id]} done")
233229
except Exception as e:
234230
estr = f": {e}" if self._params["verbose"] else ""
235-
print("failed{estr}")
231+
print(f"failed{estr}")
236232

237233

238234
def get_session(self):
@@ -244,7 +240,7 @@ def get_session(self):
244240
try:
245241
if not self._params["quiet"]:
246242
print(
247-
f"Retreiving session info of kind={self._params['kind']},"
243+
f"Retrieving session info of kind={self._params['kind']},"
248244
+ f" status={self._params['status']}"
249245
)
250246
kind = self.get_kind()

src/shapepipe/canfar/canfar_submit.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def params_default(self):
112112
"parallel_jobs": "number of tiles to process in parallel per replica; default is {}",
113113
"jobs_per_session": (
114114
"number of jobs (tiles) per session; if 0, create one session per job (default is {});"
115-
+ " Number of replicas is #FILE_IDs / JOBS_PER_SESSSION"
115+
+ " Number of replicas is #FILE_IDs / JOBS_PER_SESSION"
116116
),
117117
"stats": "print stats of sessions/batches/replicas and exit",
118118
}
@@ -130,7 +130,6 @@ def update_params(self):
130130
self._params["cores"] = self._params["parallel_jobs"]
131131
else:
132132
self._params["cores"] = self._cores_default
133-
pass
134133

135134
def check_params(self):
136135

src/shapepipe/modules/make_cat_package/make_cat.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,14 +345,15 @@ def _save_ngmix_data(self, ngmix_cat_path, moments=False):
345345
# (1) shape measurement failures (e.g. missing PSF): ok, continue
346346
# (2) previous processing errors, e.g. premature run of
347347
# merge_sep_cats_runner: raise error
348-
if len(ngmix_n_epoch) / self._cat_size_target < 0.0:
349-
ngmix_cat_file.close()
348+
if len(ngmix_n_epoch) / self._cat_size_target < 0.1:
350349
err_msg = (
351350
f"Merged shape catalogue {ngmix_cat_path} has very different"
352351
+ f" size ({len(ngmix_n_epoch)}) compared to target size"
353352
+ f" {self._cat_size_target})"
354353
)
355-
return err_msg
354+
self._w_log.info(err_msg)
355+
#ngmix_cat_file.close()
356+
#return err_msg
356357

357358
ngmix_mom_fail = ngmix_cat_file.get_data()["moments_fail"]
358359

src/shapepipe/modules/mask_package/mask.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,7 @@ def find_stars(self, position, radius):
495495
result = Vizier.query_region(coord, radius=radius*units.arcmin, catalog=self._CDS_cat_ID)
496496
if len(result) == 0:
497497
raise IndexError(
498-
"Vizier astroquer returned empty list at ",
499-
coord,
500-
radius
498+
f"Vizier astroquery returned empty list at {coord}, {radius}"
501499
)
502500
self._CDS_stdout = result[0]
503501

src/shapepipe/modules/uncompress_fits_package/uncompress_fits.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def process(self):
7272
value = header_fitsio[name]
7373
comment = header_fitsio.get_comment(name)
7474

75-
# Optional: fix invalid TFORMn
76-
if name.startswith('TFORM') and isinstance(value, str) and 'PE' in value:
77-
value = '625E'
75+
# Optional: fix invalid TFORMn
76+
if name.startswith('TFORM') and isinstance(value, str) and 'PE' in value:
77+
value = '625E'
7878

7979
header[name] = (value, comment)
8080

src/shapepipe/utilities/summary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def check_special_one(module, path):
215215
if m:
216216
code = 8
217217
msg = "WCS world2pix did not converge"
218-
return mgs, code
218+
return msg, code
219219

220220
if module == "ngmix_runner":
221221
m = re.search("finished", line)
@@ -232,8 +232,8 @@ def check_special_one(module, path):
232232

233233
if module == "ngmix_runner" and not ngmix_finished:
234234
code = 6
235-
mgs = "ngmix incomplete"
236-
return mgs, code
235+
msg = "ngmix incomplete"
236+
return msg, code
237237

238238

239239
return None, None

0 commit comments

Comments
 (0)