In [1]:
l1ascan = pd.read_hdf('/home/klay6683/to_keep/l1a_dark_scan.h5', 'df')
In [2]:
from iuvs import meta
In [3]:
l1ascan = meta.clean_up_dark_scan(l1ascan)
In [4]:
l1ascan.columns
Out[4]:
In [5]:
l1ascan.NAXIS3.value_counts(dropna=False)
Out[5]:
In [6]:
def process_fname(fname):
import pandas as pd
l1a = io.L1AReader(fname)
d = dict(fname=l1a.fname)
if l1a.n_dims == 2:
d['selfsub_mean'] = np.NAN
d['selfsub_std'] = np.NAN
return d
elif l1a.img_header['NAXIS3'] == 2:
ioffset = 0
d['danger'] = '1vs2'
else:
ioffset = 1
sub = l1a.primary_img_dn_s[0+ioffset] - l1a.primary_img_dn_s[1+ioffset]
d['selfsub_mean'] = sub.mean()
d['selfsub_std'] = sub.std()
return d
In [ ]:
process_fname(l1ascan.PRODUCT_ID.iloc[10000])
In [ ]:
from IPython.parallel import Client
c = Client()
In [ ]:
dview = c.direct_view()
lview = c.load_balanced_view()
In [ ]:
doing = l1ascan.PRODUCT_ID.unique()
results = lview.map_async(process_fname, doing)
In [ ]:
from iuvs.multitools import nb_progress_display
In [ ]:
nb_progress_display(results, doing)
In [ ]:
resdf = pd.DataFrame(results.result)
resdf.head()
In [ ]:
resdf.to_hdf("/home/klay6683/to_keep/dark_minus_dark.h5", "df")
In [7]:
resdf = pd.read_hdf("/home/klay6683/to_keep/dark_minus_dark.h5")
In [8]:
pd.__version__
Out[8]:
In [11]:
from pathlib import Path
from iuvs import io
def complete_product_id(pid):
fname = io.productionlevel1apath / Path(pid)
if fname.suffix == '.fits' or fname.suffix == '':
fname = fname.with_suffix('.fits.gz')
return str(fname)
In [12]:
l1ascan['fname'] = l1ascan.PRODUCT_ID.map(complete_product_id)
In [13]:
merged = l1ascan.merge(resdf, on='fname')
In [14]:
merged.COLLECTION_ID.value_counts()
Out[14]:
In [15]:
import seaborn as sns
sns.set_style('whitegrid')
sns.set_context('notebook')
In [16]:
%matplotlib nbagg
In [17]:
no_danger = merged[merged.danger.isnull()]
In [18]:
plt.figure()
ax = sns.stripplot(x='INT_TIME', y='selfsub_mean', hue='CHANNEL',
data=merged.sort_values(by='INT_TIME'))
ax.set_title('selfsub_mean, zoomed in')
Out[18]:
In [19]:
plt.figure()
ax = sns.boxplot(x='INT_TIME', y='selfsub_mean', hue='CHANNEL',
data=merged.sort_values(by='INT_TIME'))
ax.set_title('selfsub_mean, zoomed in')
ax.set_ylim(-0.5, 1)
ax.set_xlim(1.0, 10)
Out[19]:
In [ ]:
merged['NAXIS3'] = merged.NAXIS3.fillna(1)
In [ ]:
plt.figure()
ax = sns.countplot(x='NAXIS3', data=merged.sort_values(by='NAXIS3'))
ax.set_title('Number of darks taken per L1A file.')
In [ ]:
plt.figure()
ax = sns.countplot(x='NAXIS3', hue='INT_TIME',
data=merged[merged.INT_TIME.isin([14.4, 4.2, 1.4])].sort_values(by='NAXIS3'))
ax.set_title('Filtered for INT_TIMES 14.4, 4.2, 1.4')
In [ ]:
with_danger = merged[merged.danger=='1vs2']
In [ ]:
plt.figure()
ax = sns.boxplot(x='INT_TIME', y='selfsub_mean', hue='CHANNEL',
data=no_danger.sort_values(by='INT_TIME'))
ax.set_title('Without 1vs2 subtractions.')
ax.set_ylim(-0.5, 1)
ax.set_xlim(1,9)
In [ ]:
sns.boxplot?
In [ ]:
plt.figure()
ax = sns.boxplot(x='INT_TIME', y='selfsub_mean', hue='CHANNEL',
data=with_danger.sort_values(by='INT_TIME'))
ax.set_title("Only subtractions of first vs second.")
ax.set_ylim(-0.5, 1)
ax.set_xlim(0, 9)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
to_plot = merged[merged.COLLECTION_ID.isin(['limb','disk','corona','occulation'])]
In [ ]:
to_plot.INT_TIME.value_counts()
In [ ]: