Commits

Srikrishna Sekhar authored 75ef89ed39f
CAS-14283: make param validation a static method

The parameter validation function is now a @staticmethod, that does not invoke `self` within the class. This is in view of allowing remote execution of interactive clean.

casatasks/src/private/imagerhelpers/_gclean.mustache

Modified
237 237
238 238 if 'negativethreshold' in msg:
239 239 try:
240 240 self._negativethreshold = float(msg['negativethreshold'])
241 241 if self._negativethreshold < 0:
242 242 return -1, f"negativethreshold must be >= 0"
243 243 except ValueError:
244 244 return -1, "negativethreshold must be a number"
245 245
246 246
247 - # print automasking parameters
248 - print(f"dogrowprune: {self._dogrowprune}")
249 - print(f"noisethreshold: {self._noisethreshold}")
250 - print(f"sidelobethreshold: {self._sidelobethreshold}")
251 - print(f"lownoisethreshold: {self._lownoisethreshold}")
252 - print(f"minbeamfrac: {self._minbeamfrac}")
253 - print(f"negativethreshold: {self._negativethreshold}")
254 -
255 247 return 0, ""
256 248
257 249
258 -
259 250 def _threshold_to_float(self, msg=None):
260 251 # Convert threshold from string to float if necessary
261 252 if msg is not None:
262 253 if isinstance(msg, str):
263 254 if "mJy" in msg:
264 255 self._threshold = float(msg.replace("mJy", "")) / 1e3
265 256 elif "uJy" in msg:
266 257 self._threshold = float(msg.replace("uJy", "")) / 1e6
267 258 elif "Jy" in msg:
268 259 self._threshold = float(msg.replace("Jy", ""))
269 260 else:
270 261 if isinstance(self._threshold, str):
271 262 if "mJy" in self._threshold:
272 263 self._threshold = float(self._threshold.replace("mJy", "")) / 1e3
273 264 elif "uJy" in self._threshold:
274 265 self._threshold = float(self._threshold.replace("uJy", "")) / 1e6
275 266 elif "Jy" in self._threshold:
276 267 self._threshold = float(self._threshold.replace("Jy", ""))
277 268
278 269
279 - def _validate(self, doc, schema):
270 + @staticmethod
271 + def _validate(doc, schema):
280 272 """ Validate the input parameters against the schema.
281 273
282 274 Args:
283 275 doc: dict, input parameters
284 276 schema: dict, schema for the input parameters
285 277
286 278 Returns:
287 279 bool: True if the input parameters are valid, False otherwise
288 280 """
289 281 return _pc.validate(doc, schema)

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut