Skip to content

Commit

Permalink
Merge pull request #310 from davecoulter/develop-djones-ps1images
Browse files Browse the repository at this point in the history
Develop djones ps1images
  • Loading branch information
astrophpeter authored Mar 21, 2023
2 parents 5dd5f57 + 4b4a706 commit 7313783
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion YSE_App/common/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def GetSexigesimalString(ra_decimal, dec_decimal):

def get_psstamp_url(request, transient_id, Transient):

ps1url = ("http://plpsipp1v.stsci.edu/cgi-bin/ps1cutouts?pos=%.7f+%.7f&filter=color"%(
ps1url = ("http://ps1images.stsci.edu/cgi-bin/ps1cutouts?pos=%.7f+%.7f&filter=color"%(
Transient.objects.get(pk=transient_id).ra,Transient.objects.get(pk=transient_id).dec))

try:
Expand Down
2 changes: 1 addition & 1 deletion YSE_App/templatetags/transient_detail_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def get_ps1_image(transient):
except t.DoesNotExist:
raise Http404("Transient id does not exist")

ps1url = ("http://plpsipp1v.stsci.edu/cgi-bin/ps1cutouts?pos=%.7f+%.7f&filter=color" % (t.ra,t.dec))
ps1url = ("http://ps1images.stsci.edu/cgi-bin/ps1cutouts?pos=%.7f+%.7f&filter=color" % (t.ra,t.dec))
try:
response = requests.get(url=ps1url,timeout=5)
except: return("")
Expand Down
10 changes: 5 additions & 5 deletions YSE_App/util/mkFinderChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def panstamps_lite(ra,dec,filt,size,outfile):

try:
response = requests.get(
url="http://plpsipp1v.stsci.edu/cgi-bin/ps1cutouts",
url="http://ps1images.stsci.edu/cgi-bin/ps1cutouts",
params={
"pos": pos,
"filter": filt,
Expand All @@ -260,7 +260,7 @@ def panstamps_lite(ra,dec,filt,size,outfile):
print('HTTP Request failed')

reFitscutouts = re.compile(
r"""<th>(?P<imagetype>\w+)\s+(?P<skycellid>\d+.\d+)\s+(?P<ffilter>[\w\\]+)(\s+(?P<mjd>\d+\.\d+))?<br.*?href="(http:)?//plpsipp1v.*?Display</a>.*?Fits cutout" href="(?P<fiturl>(http:)?//plpsipp1v.*?\.fits)".*?</th>""", re.I)
r"""<th>(?P<imagetype>\w+)\s+(?P<skycellid>\d+.\d+)\s+(?P<ffilter>[\w\\]+)(\s+(?P<mjd>\d+\.\d+))?<br.*?href="(http:)?//ps1images.*?Display</a>.*?Fits cutout" href="(?P<fiturl>(http:)?//ps1images.*?\.fits)".*?</th>""", re.I)

if sys.version_info[0] < 3:
thisIter = reFitscutouts.finditer(response.content)
Expand All @@ -272,7 +272,7 @@ def panstamps_lite(ra,dec,filt,size,outfile):
imagetype = item.group("imagetype")
skycellid = item.group("skycellid")
ffilter = item.group("ffilter")
fiturl = 'http://plpsipp1v.stsci.edu%s'%item.group("fiturl")
fiturl = 'http://ps1images.stsci.edu%s'%item.group("fiturl")
if fiturl[0:5] != "http:":
fiturl = "http:" + fiturl
mjd = item.group("mjd")
Expand All @@ -282,14 +282,14 @@ def panstamps_lite(ra,dec,filt,size,outfile):
return(None)

for s in stackFitsUrls:
s = s.replace('plpsipp1v.stsci.edu//','')
s = s.replace('ps1images.stsci.edu//','').replace('amp;','')
if not os.path.dirname(outfile):
outdlfile = '%.7f_%.7f_%s.PS1.fits'%(ra,dec,time.time())
else:
outdlfile = '%s/%.7f_%.7f_%s.PS1.fits'%(os.path.dirname(outfile),ra,dec,time.time())
urllib.request.urlretrieve (s, filename=outdlfile)
break
print(outdlfile)

if os.path.exists(outdlfile):
return(outdlfile)
else: return(None)
Expand Down
2 changes: 1 addition & 1 deletion YSE_App/view_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ def get_ps1_image(request,transient_id):
except t.DoesNotExist:
raise Http404("Transient id does not exist")

ps1url = ("http://plpsipp1v.stsci.edu/cgi-bin/ps1cutouts?pos=%.7f+%.7f&filter=color" % (t.ra,t.dec))
ps1url = ("http://ps1images.stsci.edu/cgi-bin/ps1cutouts?pos=%.7f+%.7f&filter=color" % (t.ra,t.dec))
try:
response = requests.get(url=ps1url,timeout=5)
except:
Expand Down

0 comments on commit 7313783

Please sign in to comment.