Skip to content

Commit

Permalink
may nb patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ttdu authored May 7, 2024
2 parents d5bea86 + 31141b7 commit a2ab80c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
16 changes: 8 additions & 8 deletions notebooks/HSC/HSC_TAP/HSC_TAP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
"source": [
"plt.rcParams.update({'font.size': 16})\n",
"plt.figure(1,(10,6))\n",
"plt.scatter(HSC_results['A_F475W'], HSC_results['A_F475W_MAD'])\n",
"plt.scatter(HSC_results['a_f475w'], HSC_results['a_f475w_mad'])\n",
"plt.xlabel('A_F475W')\n",
"plt.ylabel('A_F475W_MAD')"
]
Expand All @@ -251,12 +251,12 @@
"metadata": {},
"outputs": [],
"source": [
"madvalues = HSC_results['A_F475W_MAD']\n",
"madvalues = HSC_results['a_f475w_mad']\n",
"i = np.argmax(madvalues)\n",
"print()\n",
"print(HSC_results[i])\n",
"\n",
"matchid = HSC_results['MatchID'][i]\n",
"matchid = HSC_results['matchid'][i]\n",
"details = HSC_service.run_async(\"\"\"\n",
"SELECT SourceID, ImageID, SourceRA, SourceDec, D, Filter, Detector, MagAper2, StartMJD\n",
"FROM dbo.DetailedCatalog\n",
Expand Down Expand Up @@ -319,10 +319,10 @@
"metadata": {},
"outputs": [],
"source": [
"f555w = HSC_results['A_F555W']\n",
"f814w = HSC_results['A_F814W']\n",
"f555w = HSC_results['a_f555w']\n",
"f814w = HSC_results['a_f814w']\n",
"VminusI = f555w-f814w\n",
"CI = HSC_results['CI']\n",
"CI = HSC_results['ci']\n",
"w = np.where((CI>0.9) & (CI<1.6) & (VminusI > -1.5) & (VminusI < 1.5))\n",
"print(len(w[0]),\"points remaining after CI and V-I filtering\")\n",
"\n",
Expand Down Expand Up @@ -401,9 +401,9 @@
"metadata": {},
"source": [
"## About this Notebook\n",
"**Authors:** Rick White & Theresa Dower, STScI Archive Scientist & Software Engineer\n",
"**Authors:** Rick White & Theresa Dower, STScI Archive Scientist & Software Engineer. Additional edits by Thomas Dutkiewicz.\n",
"\n",
"**Last Updated:** Feb 2024"
"**Last Updated:** May 2024"
]
},
{
Expand Down
39 changes: 25 additions & 14 deletions notebooks/PanSTARRS/PS1_DR2_TAP/PS1_DR2_TAP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### List available tables"
"### List available tables\n",
"\n",
"There are MANY tables available, so we'll only print out the first few. Use the commented-out for loop to see them all."
]
},
{
Expand All @@ -123,11 +125,20 @@
"outputs": [],
"source": [
"TAP_tables = TAP_service.tables\n",
"for tablename in TAP_tables.keys():\n",
" if not \"tap_schema\" in tablename: \n",
"\n",
"# only show the first three tables\n",
"for i, tablename in enumerate(TAP_tables.keys()):\n",
" if i < 10 and not \"tap_schema\" in tablename:\n",
" TAP_tables[tablename].describe()\n",
" print(\"Columns={}\".format(sorted([k.name for k in TAP_tables[tablename].columns ])))\n",
" print(\"----\")"
" print(\"----\")\n",
"\n",
"## PRINT ALL TABLES\n",
"# for tablename in TAP_tables.keys():\n",
"# if not \"tap_schema\" in tablename: \n",
"# TAP_tables[tablename].describe()\n",
"# print(\"Columns={}\".format(sorted([k.name for k in TAP_tables[tablename].columns ])))\n",
"# print(\"----\")"
]
},
{
Expand Down Expand Up @@ -217,7 +228,7 @@
"metadata": {},
"outputs": [],
"source": [
"objid = TAP_results['objID'][0]\n",
"objid = TAP_results['objid'][0]\n",
"query = \"\"\"\n",
"SELECT\n",
" objID, detectID, Detection.filterID as filterID, Filter.filterType, obsTime, ra, dec,\n",
Expand Down Expand Up @@ -301,7 +312,7 @@
"for i, filter in enumerate(['g','r','i','z','y']):\n",
" pylab.subplot(511+i)\n",
" w = np.where(detection_TAP_results['filterType']==filter)\n",
" magmean = TAP_results[f'{filter}MeanPSFMag'][0]\n",
" magmean = TAP_results[f'{filter}meanpsfmag'][0]\n",
" pylab.plot(t[w],mag[w] - magmean,'-o')\n",
" pylab.ylabel(f'{filter} [mag - {np.round(float(magmean), 4)}]')\n",
" pylab.xlim(xlim)\n",
Expand Down Expand Up @@ -330,7 +341,7 @@
"metadata": {},
"outputs": [],
"source": [
"detection_TAP_results[ (detection_TAP_results['filterType']=='z') & (np.abs(mag-TAP_results['zMeanPSFMag'][0]) > 2) ]"
"detection_TAP_results[ (detection_TAP_results['filterType']=='z') & (np.abs(mag-TAP_results['zmeanpsfmag'][0]) > 2) ]"
]
},
{
Expand All @@ -351,7 +362,7 @@
"w = np.where(detection_TAP_results['filterType']=='z')\n",
"zdtab = detection_TAP_results[w]\n",
"zdtab['mag'] = mag[w]\n",
"zdtab['dmag'] = zdtab['mag'] - TAP_results['zMeanPSFMag'][0]\n",
"zdtab['dmag'] = zdtab['mag'] - TAP_results['zmeanpsfmag'][0]\n",
"ii = np.argsort(-np.abs(zdtab['dmag']))\n",
"zdtab = zdtab[ii]\n",
"zdtab['objID','obsTime','mag','dmag','psfQfPerfect']"
Expand All @@ -377,7 +388,7 @@
"mag = -2.5*np.log10(detection_TAP_results['psfFlux']) + 8.90\n",
"magmean = 0.0*mag\n",
"for i, filter in enumerate(['g','r','i','z','y']):\n",
" magmean[detection_TAP_results['filterType']==filter] = TAP_results[f'{filter}MeanPSFMag'][0]\n",
" magmean[detection_TAP_results['filterType']==filter] = TAP_results[f'{filter}meanpsfmag'][0]\n",
"\n",
"dmag = mag - magmean\n",
"dmag1 = dmag[detection_TAP_results['psfQfPerfect']>0.9]\n",
Expand Down Expand Up @@ -426,7 +437,7 @@
"mag = -2.5*np.log10(detection_TAP_results['psfFlux']) + 8.90\n",
"magmean = 0.0*mag\n",
"for i, filter in enumerate(['g','r','i','z','y']):\n",
" magmean[detection_TAP_results['filterType']==filter] = TAP_results[f'{filter}MeanPSFMag'][0]\n",
" magmean[detection_TAP_results['filterType']==filter] = TAP_results[f'{filter}meanpsfmag'][0]\n",
" \n",
"dmag = mag - magmean\n",
"dmag1 = dmag[detection_TAP_results['psfQfPerfect']>0.9]\n",
Expand Down Expand Up @@ -504,7 +515,7 @@
"metadata": {},
"outputs": [],
"source": [
"objid = TAP_results['objID'][0]\n",
"objid = TAP_results['objid'][0]\n",
"\n",
"query = \"\"\"\n",
"SELECT\n",
Expand All @@ -525,7 +536,7 @@
"# add magnitude and difference from mean\n",
"detection_TAP_results['magmean'] = 0.0\n",
"for i, filter in enumerate([b'g',b'r',b'i',b'z',b'y']):\n",
" detection_TAP_results['magmean'][detection_TAP_results['filterType']==filter] = TAP_results[filter.decode('ascii')+'MeanPSFMag'][0]\n",
" detection_TAP_results['magmean'][detection_TAP_results['filterType']==filter] = TAP_results[filter.decode('ascii')+'meanpsfmag'][0]\n",
"detection_TAP_results['mag'] = -2.5*np.log10(detection_TAP_results['psfFlux']) + 8.90\n",
"detection_TAP_results['dmag'] = detection_TAP_results['mag']-detection_TAP_results['magmean']\n",
"\n",
Expand Down Expand Up @@ -641,7 +652,7 @@
},
"outputs": [],
"source": [
"objid = TAP_results['objID'][0]\n",
"objid = TAP_results['objid'][0]\n",
"query = \"\"\"\n",
"SELECT\n",
" objID, detectID, Detection.filterID as filterID, Filter.filterType, obsTime, ra, dec,\n",
Expand All @@ -661,7 +672,7 @@
"# add magnitude and difference from mean\n",
"detection_TAP_results['magmean'] = 0.0\n",
"for i, filter in enumerate([b'g',b'r',b'i',b'z',b'y']):\n",
" detection_TAP_results['magmean'][detection_TAP_results['filterType']==filter] = TAP_results[filter.decode('ascii')+'MeanPSFMag'][0]\n",
" detection_TAP_results['magmean'][detection_TAP_results['filterType']==filter] = TAP_results[filter.decode('ascii')+'meanpsfmag'][0]\n",
"detection_TAP_results['mag'] = -2.5*np.log10(detection_TAP_results['psfFlux']) + 8.90\n",
"detection_TAP_results['dmag'] = detection_TAP_results['mag']-detection_TAP_results['magmean']\n",
"\n",
Expand Down

0 comments on commit a2ab80c

Please sign in to comment.