import webbrowser
import argparse
parser = argparse.ArgumentParser(
description="useage: python main.py --simbad_portal_flag ",
prog='ESA Hubble',
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument(
'--cds_portal_flag', action='store_true',
default=os.environ.get("cds_portal_flag", False),
help=''
)
parser.add_argument(
'--simbad_portal_flag', action='store_true',
default=os.environ.get("simbad_portal_flag", False),
help=''
)
parser.add_argument(
'--sdss_portal_flag', action='store_true',
default=os.environ.get("sdss_portal_flag", False),
help=''
)
parser.add_argument(
'--PanStarrs_portal_flag', action='store_true',
default=os.environ.get("PanStarrs_portal_flag", False),
help=''
)
parser.add_argument(
'--Aladin_portal_flag', action='store_true',
default=os.environ.get("Aladin_portal_flag", False),
help=''
)
parser.add_argument(
'--esa_portal_flag', action='store_true',
default=os.environ.get("esa_portal_flag", False),
help=''
)
args = parser.parse_args()
# cds_portal_flag = 'N'
# simbad_portal_flag = 'Y'
# sdss_portal_flag = 'N'
# PanStarrs_portal_flag = 'Y'
# Aladin_portal_flag = 'N'
# esa_portal_flag = 'Y'
xRa = "RA"
yDec = "DEC"
if args.cds_portal_flag:
webbrowser.open(f'http://cdsportal.u-strasbg.fr/?target={xRa}%20{yDec}')
if args.simbad_portal_flag:
webbrowser.open('http://simbad.cds.unistra.fr/simbad/sim-coo?Coord={xRa}+{yDec}'\
'&CooFrame=FK5&CooEpoch=2000&CooEqui=2000&CooDefinedFrames=none&Radius=2&Radius.unit=arcmin&submit=submit+query')
if args.sdss_portal_flag:
sdss_portal = 'http://skyserver.sdss.org/dr17/VisualTools/quickobj?ra=' + str(xRa) + '&dec=' + str(yDec)
webbrowser.open(sdss_portal)
if args.PanStarrs_portal_flag:
PanStarrs_portal = 'http://ps1images.stsci.edu/cgi-bin/ps1cutouts?pos=' + str(xRa) + ' ' + \
str(yDec) + '&filter=color&filter=g&filter=r&filter=i&filter=z&filter=y&filetypes=stack&auxiliary=data&size=240&output_size=0&verbose=0&autoscale=99.500000&catlist='
webbrowser.open(PanStarrs_portal)
if args.Aladin_portal_flag:
radec = str(xRa) + ' ' + str(yDec)
webbrowser.open(f'https://aladin.u-strasbg.fr/AladinLite/?target={str(radec)}')
if args.esa_portal_flag:
webbrowser.open(f'https://esahubble.org/images/{str(ESA_name)}')
webbrowser.open(f'https://esahubble.org/images/{str(ESA_name)}/zoomable/')
webbrowser.open(f'https://esahubble.org/media/archives/images/large/{str(ESA_name)}.jpg')
#webbrowser.open('https://esahubble.org/media/archives/images/original/' + str(ESA_name) + ".tif")
Hey thought I'd suggest some food for thought!
Same script using argparse and Fstrings
(only sudo code, I didnt test it as It's just 1 script)