Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_imdev.py: 18%

28 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 17:39 +0000

1import sys 

2 

3from casatools import image, coordsys, regionmanager 

4from casatasks import casalog 

5 

6from .ialib import write_image_history 

7 

8def imdev( 

9 imagename, outfile, region, box, chans, 

10 stokes, mask, overwrite, stretch, 

11 grid, anchor, xlength, ylength, interp, stattype, statalg, 

12 zscore, maxiter 

13): 

14 _myia = image() 

15 _myrg = regionmanager() 

16 _mycs = coordsys() 

17 try: 

18 casalog.origin('imdev') 

19 _myia.open(imagename) 

20 _mycs = _myia.coordsys() 

21 csrec = _mycs.torecord() 

22 shape = _myia.shape() 

23 reg = _myrg.frombcs( 

24 csrec, shape, 

25 box, chans, stokes, "a", region 

26 ) 

27 outia = _myia.deviation( 

28 outfile=outfile, region=reg, mask=mask, 

29 overwrite=overwrite, stretch=stretch, grid=grid, 

30 anchor=anchor, xlength=xlength, ylength=ylength, 

31 interp=interp, stattype=stattype, statalg=statalg, 

32 zscore=zscore, maxiter=maxiter 

33 ) 

34 try: 

35 param_names = imdev.__code__.co_varnames[:imdev.__code__.co_argcount] 

36 vars = locals() 

37 param_vals = [vars[p] for p in param_names] 

38 write_image_history( 

39 outia, sys._getframe().f_code.co_name, 

40 param_names, param_vals, casalog 

41 ) 

42 except Exception as instance: 

43 casalog.post("*** Error \'%s\' updating HISTORY" % (instance), 'WARN') 

44 

45 finally: 

46 _myia.done() 

47 _myrg.done() 

48 _mycs.done() 

49 if outia: 

50 outia.done()