|  | 
| 12 | 12 | from pathlib import Path | 
| 13 | 13 | from pprint import pformat | 
| 14 | 14 | from typing import NamedTuple as Struct | 
|  | 15 | +from typing import overload | 
| 15 | 16 | 
 | 
| 16 | 17 | import astropy.units as u | 
| 17 | 18 | import numpy as np | 
| @@ -216,9 +217,21 @@ def genparset( | 
| 216 | 217 |     return parset_file | 
| 217 | 218 | 
 | 
| 218 | 219 | 
 | 
|  | 220 | +@overload | 
|  | 221 | +def linmos( | 
|  | 222 | +    parset: None, fieldname: str, image: str, holofile: Path | None = None | 
|  | 223 | +) -> None: ... | 
|  | 224 | + | 
|  | 225 | + | 
|  | 226 | +@overload | 
|  | 227 | +def linmos( | 
|  | 228 | +    parset: str, fieldname: str, image: str, holofile: Path | None = None | 
|  | 229 | +) -> pymongo.UpdateOne: ... | 
|  | 230 | + | 
|  | 231 | + | 
| 219 | 232 | @task(name="Run linmos") | 
| 220 | 233 | def linmos( | 
| 221 |  | -    parset: str | None, fieldname: str, image: str, holofile: Path | 
|  | 234 | +    parset: str | None, fieldname: str, image: str, holofile: Path | None = None | 
| 222 | 235 | ) -> pymongo.UpdateOne | None: | 
| 223 | 236 |     """Run linmos | 
| 224 | 237 | 
 | 
| @@ -248,12 +261,15 @@ def linmos( | 
| 248 | 261 |     log_file = parset.replace(".in", ".log") | 
| 249 | 262 |     linmos_command = shlex.split(f"linmos -c {parset}") | 
| 250 | 263 | 
 | 
| 251 |  | -    holo_folder = holofile.parent | 
|  | 264 | +    bind_dir_str = f"{rootdir}:{rootdir}" | 
|  | 265 | +    if holofile is not None: | 
|  | 266 | +        holo_folder = holofile.parent | 
|  | 267 | +        bind_dir_str += f",{holo_folder}:{holo_folder}" | 
| 252 | 268 | 
 | 
| 253 | 269 |     output = sclient.execute( | 
| 254 | 270 |         image=image, | 
| 255 | 271 |         command=linmos_command, | 
| 256 |  | -        bind=f"{rootdir}:{rootdir},{holo_folder}:{holo_folder}", | 
|  | 272 | +        bind=bind_dir_str, | 
| 257 | 273 |         return_result=True, | 
| 258 | 274 |         quiet=False, | 
| 259 | 275 |         stream=True, | 
|  | 
0 commit comments