示例#1
0
def norm_img(data, mode='max'):
    out = np.nan_to_num(data)
    out -= np.amin(out)
    if mode == 'max':
        out /= np.amax(out)
    elif mode == 'mean':
        out /= np.amean(out)
    return out
示例#2
0
 def set_concn_rate_results(self, concn_array, rate_array):
     # This doesn't take account of detail_level!
     # See update_concn_rate_results()
     calculated_flux = \
                 numpy.sum(numpy.absolute(rate_array))/2
     rel_diff = abs(numpy.sum(rate_array))/calculated_flux
     max_concn = numpy.max(concn_array)
     amean_concn = amean(concn_array)
     min_concn = numpy.min(concn_array)
     concn_rate = self.find('./simulation/concn_rate')
     if concn_rate == None:
         sim = self.find('./simulation')
         concn_rate = xmlTree.SubElement(sim, 'concn_rate')
     concn_rate.set('calculated_flux', str(calculated_flux))
     concn_rate.set('rel_diff',  str(rel_diff))
     concn_rate.set('max_concn', str(max_concn))
     concn_rate.set('amean_concn', str(amean_concn))
     concn_rate.set('min_concn', str(min_concn))
示例#3
0
def obj_func(point, args):
    ls_radius = np.array(
        [indx_rad_phi(point, i)[0] for i in range(df.shape[0])])
    return np.log(amean(ls_radius)) - np.log(gmean(ls_radius))
示例#4
0
 def _centermesh(self, vert_sequence):
     """Translates mesh centroid to XYZ coordinate origin."""
     centroid = amean(vert_sequence, axis=0)
     return array([subtract(vert,centroid) for vert in vert_sequence])