mhardcastle / radioflux

Measuring radio flux density with ds9
GNU General Public License v3.0
12 stars 3 forks source link

Error invoking Radioflux plugin in Windows - possible solution given #18

Open LizWhitehead opened 2 weeks ago

LizWhitehead commented 2 weeks ago

The problem looked to be a combination of Windows and radioflux-ds9.py reading in file/region arguments using sys.stdin.readline. I updated my radioflux-ds9.py, to accept these as positional arguments, and also updated the associated launch commands in my radio-flux.ds9. The invocation then worked. [There are also a couple of Linux commands in the install script ("sed" and "chmod"), the equivalent of which had to be done manually.]

The updated lines in radioflux-ds9.py are:

parser = argparse.ArgumentParser(description='ds9 plugin to measure fluxes from FITS files.') parser.add_argument('-s','--subtract', dest='bgsub', action='store_const', const=1,default=0,help='Subtract background') parser.add_argument(dest='fname') parser.add_argument(dest='f_reg') parser.add_argument(dest='b_reg') args = parser.parse_args()

filename=args.fname.rstrip() filename=re.sub(r'[.*]','',filename) f_region=args.f_reg.rstrip() b_region=args.b_reg.rstrip()

My radio-flux.ds9 file is now:

Radio flux measurement menu python "C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python39_64/Lib/site-packages/radioflux/radioflux-ds9.py" "$filename" "$regions(source,ds9,image)" "$regions(background,ds9,image)" | $text Radio flux measurement (background subtraction) menu python "C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python39_64/Lib/site-packages/radioflux/radioflux-ds9.py" -s "$filename" "$regions(source,ds9,image)" "$regions(background,ds9,image)" | $text

mhardcastle commented 2 weeks ago

Thanks for the comment, I'll leave this open till I can see if there's any way of fixing at least some of the issues. To be honest I'm impressed that it can even be made to work on Windows...