reformat code using python-lsp-ruff
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
from getopt import getopt, error as get_error
|
||||
from getopt import error as get_error
|
||||
from getopt import getopt
|
||||
from sys import argv
|
||||
|
||||
arglist = argv[1:]
|
||||
@@ -24,7 +25,7 @@ try:
|
||||
elif curr_arg in ("-i", "--snri"):
|
||||
SNRi_cut = int(curr_val)
|
||||
elif curr_arg in ("-l", "--lim"):
|
||||
flux_lim = list("".join(curr_val).split(','))
|
||||
flux_lim = list("".join(curr_val).split(","))
|
||||
except get_error as err:
|
||||
print(str(err))
|
||||
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
|
||||
def main(infiles=None):
|
||||
"""
|
||||
Retrieve native spatial resolution from given observation.
|
||||
"""
|
||||
from os.path import join as path_join
|
||||
from warnings import catch_warnings, filterwarnings
|
||||
|
||||
from astropy.io.fits import getheader
|
||||
from astropy.wcs import WCS, FITSFixedWarning
|
||||
from numpy.linalg import eig
|
||||
|
||||
if infiles is None:
|
||||
print("Usage: \"python get_cdelt.py -f infiles\"")
|
||||
print('Usage: "python get_cdelt.py -f infiles"')
|
||||
return 1
|
||||
prod = [["/".join(filepath.split('/')[:-1]), filepath.split('/')[-1]] for filepath in infiles]
|
||||
prod = [["/".join(filepath.split("/")[:-1]), filepath.split("/")[-1]] for filepath in infiles]
|
||||
data_folder = prod[0][0]
|
||||
infiles = [p[1] for p in prod]
|
||||
|
||||
@@ -21,14 +23,14 @@ def main(infiles=None):
|
||||
size = {}
|
||||
for currfile in infiles:
|
||||
with catch_warnings():
|
||||
filterwarnings('ignore', message="'datfix' made the change", category=FITSFixedWarning)
|
||||
filterwarnings("ignore", message="'datfix' made the change", category=FITSFixedWarning)
|
||||
wcs = WCS(getheader(path_join(data_folder, currfile))).celestial
|
||||
key = currfile[:-5]
|
||||
size[key] = wcs.array_shape
|
||||
if wcs.wcs.has_cd():
|
||||
cdelt[key] = eig(wcs.wcs.cd)[0]*3600.
|
||||
cdelt[key] = eig(wcs.wcs.cd)[0] * 3600.0
|
||||
else:
|
||||
cdelt[key] = wcs.wcs.cdelt*3600.
|
||||
cdelt[key] = wcs.wcs.cdelt * 3600.0
|
||||
|
||||
print("Image name, native resolution in arcsec and shape")
|
||||
for currfile in infiles:
|
||||
@@ -41,7 +43,7 @@ def main(infiles=None):
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description='Query MAST for target products')
|
||||
parser.add_argument('-f', '--files', metavar='path', required=False, nargs='*', help='the full or relative path to the data products', default=None)
|
||||
parser = argparse.ArgumentParser(description="Query MAST for target products")
|
||||
parser.add_argument("-f", "--files", metavar="path", required=False, nargs="*", help="the full or relative path to the data products", default=None)
|
||||
args = parser.parse_args()
|
||||
exitcode = main(infiles=args.files)
|
||||
|
||||
Reference in New Issue
Block a user