Пример #1
0
 def post(self):
     form = cgi.FieldStorage()
     thefile = form['file-0']
     iter_html=loop_html(thefile)
     templatepath = os.path.dirname(__file__) + '/../templates/'
     ChkCookie = self.request.cookies.get("ubercookie")
     # html = uber_lib.SkinChk(ChkCookie)
     # html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'iec','page':'batchinput'})
     # html = html + template.render (templatepath + '03ubertext_links_left.html', {})                
     html = template.render(templatepath + '04uberbatch_start.html', {
             'model':'iec',
             'model_attributes':'IEC Batch Output'})
     html = html + iec_tables.timestamp("",jid_batch[0])
     html = html + iter_html
     # html = html + template.render(templatepath + 'sip-batchoutput-jqplot.html', {})
     html = html + template.render(templatepath + 'export.html', {})
     html = html + template.render(templatepath + '04uberoutput_end.html', {'sub_title': ''})
     # html = html + template.render(templatepath + '06uberfooter.html', {'links': ''})
     rest_funcs.batch_save_dic(html, [x.__dict__ for x in iec_obj_all], 'iec', 'batch', jid_batch[0], ChkCookie, templatepath)
     self.response.out.write(html)
Пример #2
0
 def post(self):        
     form = cgi.FieldStorage()   
     LC50 = float(form.getvalue('LC50'))
     threshold = float(form.getvalue('threshold'))
     dose_response = float(form.getvalue('dose_response'))
     iec_obj = iec_model.iec(True,True,'single',dose_response, LC50, threshold, None)
     text_file = open('iec/iec_description.txt','r')
     x1 = text_file.read()
     templatepath = os.path.dirname(__file__) + '/../templates/'
     ChkCookie = self.request.cookies.get("ubercookie")
     html = uber_lib.SkinChk(ChkCookie, "IEC Output")
     html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html',  {'model':'iec','page':'output'})
     html = html + template.render (templatepath + '03ubertext_links_left.html', {})                               
     html = html + template.render(templatepath + '04uberoutput_start.html', {
             'model':'iec', 
             'model_attributes':'IEC Output'})
     html = html + iec_tables.timestamp(iec_obj)
     html = html + iec_tables.table_all(iec_obj)
     html = html + template.render(templatepath + 'export.html', {})
     html = html + template.render(templatepath + '04uberoutput_end.html', {})
     html = html + template.render(templatepath + '06uberfooter.html', {'links': ''})
     rest_funcs.save_dic(html, iec_obj.__dict__, "iec", "single")
     self.response.out.write(html)
Пример #3
0
    def post(self):        
        form = cgi.FieldStorage()   
        NOI = int(form.getvalue('NOI'))
        LC50 = form.getvalue('LC50')
        if LC50=="Uniform":
            LC50_lower=float(form.getvalue('LC50_lower'))
            LC50_upper=float(form.getvalue('LC50_upper'))
            LC50_pool=np.random.uniform(LC50_lower, LC50_upper, NOI)
        elif LC50=="Normal":
            LC50_mean=float(form.getvalue('LC50_mean'))
            LC50_std=float(form.getvalue('LC50_std'))
            LC50_pool=np.random.normal(LC50_mean, LC50_std, NOI)
        elif LC50=="Log-normal":
            LC50_mean=float(form.getvalue('LC50_mean'))
            LC50_std=float(form.getvalue('LC50_std'))
            LC50_pool=np.random.lognormal(LC50_mean, LC50_std, NOI)

        threshold = form.getvalue('threshold')
        if threshold=="Uniform":
            threshold_lower=float(form.getvalue('threshold_lower'))
            threshold_upper=float(form.getvalue('threshold_upper'))
            threshold_pool=np.random.uniform(threshold_lower, threshold_upper, NOI)
        elif threshold=="Normal":
            threshold_mean=float(form.getvalue('threshold_mean'))
            threshold_std=float(form.getvalue('threshold_std'))
            threshold_pool=np.random.normal(threshold_mean, threshold_std, NOI)
        elif threshold=="Log-normal":
            threshold_mean=float(form.getvalue('threshold_mean'))
            threshold_std=float(form.getvalue('threshold_std'))
            threshold_pool=np.random.lognormal(threshold_mean, threshold_std, NOI)

        dose_response = form.getvalue('dose_response')
        if dose_response=="Uniform":
            dose_response_lower=float(form.getvalue('dose_response_lower'))
            dose_response_upper=float(form.getvalue('dose_response_upper'))
            dose_response_pool=np.random.uniform(dose_response_lower, dose_response_upper, NOI)
        elif dose_response=="Normal":
            dose_response_mean=float(form.getvalue('dose_response_mean'))
            dose_response_std=float(form.getvalue('dose_response_std'))
            dose_response_pool=np.random.normal(dose_response_mean, dose_response_std, NOI)
        elif dose_response=="Log-normal":
            dose_response_mean=float(form.getvalue('dose_response_mean'))
            dose_response_std=float(form.getvalue('dose_response_std'))
            dose_response_pool=np.random.lognormal(dose_response_mean, dose_response_std, NOI)

        z_score_f_pool=[]
        F8_f_pool=[]
        chance_f_pool=[]

        for i in range(NOI):
            iec_obj_temp = iec_model.iec(True, True, dose_response_pool[i], LC50_pool[i], threshold_pool[i])
            z_score_f_pool.append(iec_obj_temp.z_score_f_out)
            F8_f_pool.append(iec_obj_temp.F8_f_out)
            chance_f_pool.append(iec_obj_temp.chance_f_out)


        templatepath = os.path.dirname(__file__) + '/../templates/'
        ChkCookie = self.request.cookies.get("ubercookie")
        html = uber_lib.SkinChk(ChkCookie, "IEC Uncertainty Output")
        html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html',  {'model':'iec','page':'output'})
        html = html + template.render (templatepath + '03ubertext_links_left.html', {})                               
        html = html + template.render(templatepath + '04uberoutput_start.html', {
                'model':'iec', 
                'model_attributes':'IEC Uncertainty Output'})
        html = html + iec_tables.timestamp()
        html = html + iec_tables.table_all_un(LC50_pool, threshold_pool, dose_response_pool, z_score_f_pool, F8_f_pool, chance_f_pool)

        num_bin_z_score = int(1+3.3*np.log10(len(z_score_f_pool)))
        num_bin_chance_f = int(1+3.3*np.log10(len(chance_f_pool)))

        html = html + '<div>'
        html = html + hist_plot(z_score_f_pool, num_bin_z_score, 'Z Score', id_generator(), 1) + '<br>'
        html = html + hist_plot(chance_f_pool, num_bin_chance_f, 'Chance F', id_generator(), 2) + '<br>'
        html = html + '</div>'

        html = html + template.render(templatepath + 'export.html', {})
        html = html + template.render(templatepath + '04uberoutput_end.html', {}) 
        html = html + template.render(templatepath + '06uberfooter.html', {'links': ''})
        self.response.out.write(html)