In [1]:
%load_ext watermark
%watermark -u -d -v -p numpy,matplotlib,scipy,pandas,sklearn,mlxtend


last updated: 2017-10-14 

CPython 2.7.13
IPython 5.3.0

numpy 1.12.1
matplotlib 2.0.2
scipy 0.19.0
pandas 0.20.1
sklearn 0.19.0
mlxtend 0.7.0

In [2]:
%load_ext line_profiler

In [3]:
import comptools as comp
import comptools.analysis.anisotropy as anisotropy
# from benchmarks import cut_df, ref_process


/home/jbourbeau/.virtualenvs/composition/lib/python2.7/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)

In [4]:
%timeit df_sim = comp.load_sim(config='IC86.2012', test_size=0)


/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:144: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['lap_log_energy'] = np.nan_to_num(np.log10(df['lap_energy']))
/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:149: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['InIce_log_charge_'+i] = np.log10(df['InIce_charge_'+i])
/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:150: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['log_NChannels_'+i] = np.log10(df['NChannels_'+i])
/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:151: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['log_NHits_'+i] = np.log10(df['NHits_'+i])
/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:152: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['lap_cos_zenith'] = np.cos(df['lap_zenith'])
/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:154: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['log_s'+dist] = np.log10(df['lap_s'+dist])
/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:155: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['log_dEdX'] = np.log10(df['eloss_1500_standard'])
/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:156: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['log_d4r_peak_energy'] = np.log10(df['d4r_peak_energy'])
/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:157: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['log_d4r_peak_sigma'] = np.log10(df['d4r_peak_sigma'])
1 loop, best of 3: 17.2 s per loop

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [4]:
%lprun -f comp.get_training_features comp.get_training_features()

In [5]:
pipeline_str = 'GBDT'
%lprun -f comp.get_pipeline comp.get_pipeline(pipeline_str)

In [10]:
%lprun -f comp.get_training_features()

In [9]:
%lprun -f comp.load_dataframe comp.load_dataframe(datatype='sim', config='IC86.2012')


Starting out with 108522 sim events
sim quality cut event flow:
      passed_IceTopQualityCuts:    1.0    1.0
FractionContainment_Laputop_InIce:  0.793  0.793
       passed_InIceQualityCuts:  0.795   0.76
                 num_hits_1_60:  0.997  0.759



In [4]:
data_df = comp.load_dataframe(datatype='data', config='IC86.2012')
times = data_df.start_time_mjd.values


Starting out with 8020592 data events
data quality cut event flow:
      passed_IceTopQualityCuts:    1.0    1.0
FractionContainment_Laputop_InIce:    1.0    1.0
       passed_InIceQualityCuts:  0.918  0.918
                 num_hits_1_60:    1.0  0.918


/home/jbourbeau/cr-composition/comptools/dataframe_functions.py:140: RuntimeWarning: invalid value encountered in log10
  df['log_dEdX'] = np.log10(df['eloss_1500_standard'])

In [7]:
%lprun -f anisotropy.make_skymaps anisotropy.make_skymaps(data_df.loc[:200], times, n_resamples=20, n_side=64, verbose=False)

In [ ]: