From 4362db0cab59e17b560270e5c1fe903d5cea4bdd Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 9 Nov 2016 15:55:46 -0500 Subject: [PATCH] automatised new_mocks.LIST --- Inflate_errorbars.ipynb | 68 ++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 41 deletions(-) diff --git a/Inflate_errorbars.ipynb b/Inflate_errorbars.ipynb index ecc52e2..bedd7de 100644 --- a/Inflate_errorbars.ipynb +++ b/Inflate_errorbars.ipynb @@ -65,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 24, "metadata": { "collapsed": true }, @@ -98,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 25, "metadata": { "collapsed": false }, @@ -109,7 +109,7 @@ "1" ] }, - "execution_count": 3, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -123,7 +123,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 26, "metadata": { "collapsed": false }, @@ -134,7 +134,7 @@ "'DES_SN002457.DAT'" ] }, - "execution_count": 4, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -145,7 +145,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 33, "metadata": { "collapsed": false }, @@ -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", @@ -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", @@ -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", @@ -264,7 +261,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "collapsed": false }, @@ -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", @@ -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",