Skip to content

Commit

Permalink
automatised new_mocks.LIST
Browse files Browse the repository at this point in the history
  • Loading branch information
rlschuhmann committed Nov 9, 2016
1 parent 039b1a3 commit 4362db0
Showing 1 changed file with 27 additions and 41 deletions.
68 changes: 27 additions & 41 deletions Inflate_errorbars.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 24,
"metadata": {
"collapsed": true
},
Expand Down Expand Up @@ -98,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 25,
"metadata": {
"collapsed": false
},
Expand All @@ -109,7 +109,7 @@
"1"
]
},
"execution_count": 3,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -123,7 +123,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 26,
"metadata": {
"collapsed": false
},
Expand All @@ -134,7 +134,7 @@
"'DES_SN002457.DAT'"
]
},
"execution_count": 4,
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -145,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 33,
"metadata": {
"collapsed": false
},
Expand Down Expand Up @@ -181,11 +181,6 @@
" test_table_II = dat.data['DES_SN002457.DAT']\n",
" test_table_Ia = dat.data['DES_SN002542.DAT']\n",
" test_table_Ibc = dat.data['DES_SN005399.DAT']\n",
"#print test_table_II\n",
"\n",
"#test_table_Ia.replace_column('mjd', test_table_Ia['mjd']+56178)\n",
"#test_table_II.replace_column('mjd', test_table_II['mjd']+56178)\n",
"#test_table_Ibc.replace_column('mjd', test_table_Ibc['mjd']+56178)\n",
"\n",
" test_table_II.rename_column('flux', 'FLUXCAL')\n",
" test_table_II.rename_column('flux_error', 'FLUXCALERR')\n",
Expand All @@ -208,6 +203,7 @@
"\n",
" realspertype=realsperlc*(len(prototypes_Ia)+len(prototypes_II)+len(prototypes_Ibc))\n",
" \n",
" logfile=open('new_mocks/new_mocks.LIST', 'w')\n",
" for i in range(realsperlc):\n",
" test_table_Ia.replace_column('FLUXCAL', type_Ia[:,i])\n",
" test_table_Ibc.replace_column('FLUXCAL', type_Ibc[:,i])\n",
Expand All @@ -220,29 +216,30 @@
" make_new_data(filename_Ibc, test_table_Ibc, 'Ibc_%s'%i, 3)\n",
" make_new_data(filename_II, test_table_II, 'II_%s'%i, 2)\n",
" make_new_data(filename_Ia, test_table_Ia, 'Ia_%s'%i, 1)\n",
" \n",
" new_data[(str)(i)]=test_table_II.copy() #new_light_curve_Ia\n",
" new_data[(str)(i+realspertype)]=test_table_Ia.copy()#new_light_curve_II\n",
" new_data[(str)(i+2*realspertype)]=test_table_Ibc.copy()#new_light_curve_Ibc\n",
" \n",
"#sncosmo.read_lc(new_data)\n",
"#new_data = Counter(new_data_Ia) + Counter(new_data_II) + Counter(new_data_Ibc)\n",
"\n",
" for i in range(realspertype*(len(prototypes_II)+len(prototypes_Ia)+len(prototypes_Ibc))): \n",
" objs.append((str)(i))\n",
" \n",
" dat.object_names=np.asarray(objs)\n",
" dat.data=new_data"
" logfile.write('Ia_'+str(i)+'.dat\\nII_'+str(i)+'.dat\\nIbc_'+str(i)+'.dat\\n')\n",
" logfile.close()\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading data...\n",
"11 objects read into memory.\n"
]
}
],
"source": [
"produce_mock_data_set(1.1)"
]
},
{
"cell_type": "code",
Expand All @@ -264,7 +261,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"collapsed": false
},
Expand All @@ -281,7 +278,7 @@
" types['Type'][np.floor(types['Type']/10)==3]=3\n",
" %%capture --no-stdout\n",
" \n",
" mod1Feats=snfeatures.ParametricFeatures('newling',sampler='leastsq')\n",
" mod1Feats=snfeatures.ParametricFeatures('karpenka',sampler='leastsq')\n",
" mod1_features=mod1Feats.extract_features(dat1,nprocesses=4,chain_directory=out_int)\n",
" mod1_features.write('%s_karpenka.dat' %run_name, format='ascii')\n",
" #Unfortunately, sometimes the fitting methods return NaN for some parameters for these models.\n",
Expand Down Expand Up @@ -390,18 +387,7 @@
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading data...\n",
"11 objects read into memory.\n",
"Reading data...\n",
"2001 objects read into memory.\n"
]
}
],
"outputs": [],
"source": [
"classifiers=['nb','svm','boost_dt']\n",
"\n",
Expand Down

0 comments on commit 4362db0

Please sign in to comment.