Skip to content

Commit

Permalink
Add labels on outliers
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarayan committed Sep 5, 2017
1 parent 00e9a81 commit f425521
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions data/photometry/20170731/compare_old_new_apparent_mags.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Compare old and new apparent magnitudes from AC photometry
'''
import sys
import os
import numpy as np
import astropy.table as at
from astropy.visualization import hist
import matplotlib.pyplot as plt
Expand All @@ -22,7 +23,7 @@ def main():
fig3 = plt.figure(figsize=(10,15))

cols = 'purple,blue,green,red,orange,black'
col_pbs = dict(zip(pbs, cols.split(',')))
col_pbs = dict(zip(pbs, cols.split(',')))

combined = at.join(old, new, keys='obj', table_names=['old','new'])
print(combined)
Expand All @@ -46,10 +47,17 @@ def main():
ax1.set_xlabel('Old Mag')
ax1.set_ylabel('New Mag')

ax2.errorbar(combined[old_key], combined[new_key] - combined[old_key],\
deltaMag = combined[new_key] - combined[old_key]
ax2.errorbar(combined[old_key], deltaMag,\
xerr=combined[old_ekey], yerr = combined[new_ekey],\
marker='o', linestyle='None', color=col_pbs[pb], label=pb)
ax2.axhline(0., marker='None', linestyle='--', color='black', alpha=0.5)
mean_deltaMag = deltaMag.mean()
std_deltaMag = deltaMag.std()

for label, x, y in zip(combined['obj'], combined[old_key], deltaMag):
if np.abs(y - mean_deltaMag) > 2.5*std_deltaMag:
ax2.annotate(label, (x, y), rotation=90)
ax2.legend(frameon=False)
ax2.set_xlabel('Old Mag')
ax2.set_ylabel('Delta (New - Old) Mag')
Expand Down

0 comments on commit f425521

Please sign in to comment.