Skip to content

Commit f71e3e9

Browse files
committed
final improvements
1 parent 731e3a6 commit f71e3e9

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

DP1/300_Science_Demos/305_Galactic_variables_and_transients/305_2_Stellar_Variability_Characterization.ipynb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@
480480
" \"FROM dp1.ForcedSourceOnDiaObject as fsodo \"\n",
481481
" \"JOIN dp1.CcdVisit as cv \"\n",
482482
" \"ON (cv.visitId = fsodo.visit AND cv.detector = fsodo.detector)\"\n",
483-
" \"WHERE fsodo.psfFlux > 0.0 AND diaObjectId = \"+str(id))\n",
483+
" \"WHERE pixelFlags_bad = 0 AND diaObjectId = \"+str(id))\n",
484484
"\n",
485485
" results = results.to_table()\n",
486486
" results_dict[id] = results\n",
@@ -544,11 +544,17 @@
544544
" obj_mjd_days = np.array(results['expMidptMJD']) * u.day\n",
545545
" obj_fluxes = np.array(results['psfFlux'])\n",
546546
" obj_flux_errs = np.array(results['psfFluxErr'])\n",
547-
" obj_frequency, obj_power =\\\n",
548-
" LombScargleMultiband(obj_mjd_days, obj_fluxes,\n",
549-
" results['band'], obj_flux_errs).autopower(minimum_frequency=minfreq,\n",
550-
" maximum_frequency=maxfreq,\n",
551-
" samples_per_peak=20)\n",
547+
" ls_model = LombScargleMultiband(\n",
548+
" obj_mjd_days,\n",
549+
" obj_fluxes,\n",
550+
" results['band'],\n",
551+
" obj_flux_errs\n",
552+
" )\n",
553+
" obj_frequency, obj_power = ls_model.autopower(\n",
554+
" minimum_frequency=minfreq,\n",
555+
" maximum_frequency=maxfreq,\n",
556+
" samples_per_peak=20\n",
557+
" )\n",
552558
" max_power = np.argmax(obj_power)\n",
553559
" obj_freq = obj_frequency[max_power]\n",
554560
" obj_period = 1.0 / obj_freq\n",
@@ -682,8 +688,8 @@
682688
" ms=8, mew=0, alpha=0.5, label=band)\n",
683689
"\n",
684690
" plt.gca().invert_yaxis()\n",
685-
" plt.legend()\n",
686-
" plt.title(f\"{my_id}; period: {obj_period: .8F}\")\n",
691+
" plt.legend(ncol=4, loc=\"lower right\")\n",
692+
" plt.title(f\"Period: {obj_period: .8F}\")\n",
687693
" plt.xlabel('phase')\n",
688694
" plt.ylabel('magnitude')\n",
689695
" plt.ylim(np.nanpercentile(mag, 95)+0.3, np.nanpercentile(mag, 5)-0.3)\n",

0 commit comments

Comments
 (0)