def convergence_measure_all(filename,index,fits_loader=None): """ Measures all the statistical descriptors of a convergence map as indicated by the index instance """ logging.debug("Processing {0}".format(filename)) #Load the map if fits_loader is not None: conv_map = ConvergenceMap.load(filename,format=fits_loader) else: conv_map = ConvergenceMap.load(filename,format=load_fits_default_convergence) #Allocate memory for observables descriptors = index observables = np.zeros(descriptors.size) #Measure descriptors as directed by input for n in range(descriptors.num_descriptors): if type(descriptors[n]) == PowerSpectrum: l,observables[descriptors[n].first:descriptors[n].last] = conv_map.powerSpectrum(descriptors[n].l_edges) elif type(descriptors[n]) == Moments: observables[descriptors[n].first:descriptors[n].last] = conv_map.moments(connected=descriptors[n].connected) elif type(descriptors[n]) == Peaks: v,observables[descriptors[n].first:descriptors[n].last] = conv_map.peakCount(descriptors[n].thresholds,norm=descriptors[n].norm) elif type(descriptors[n]) == PDF: v,observables[descriptors[n].first:descriptors[n].last] = conv_map.pdf(descriptors[n].thresholds,norm=descriptors[n].norm) elif type(descriptors[n]) == MinkowskiAll: v,V0,V1,V2 = conv_map.minkowskiFunctionals(descriptors[n].thresholds,norm=descriptors[n].norm) observables[descriptors[n].first:descriptors[n].last] = np.hstack((V0,V1,V2)) elif type(descriptors[n]) == MinkowskiSingle: raise ValueError("Due to computational performance you have to measure all Minkowski functionals at once!") else: raise ValueError("Measurement of this descriptor not implemented!!!") #Return return observables
def peaks_loader(filename,thresholds): logging.debug("Processing {0} peaks".format(filename)) conv_map = ConvergenceMap.load(filename,format=load_fits_default_convergence) v,pk = conv_map.peakCount(thresholds,norm=True) return v
def peaks_loader(filename, thresholds): logging.debug("Processing {0} peaks".format(filename)) conv_map = ConvergenceMap.load(filename, format=load_fits_default_convergence) v, pk = conv_map.peakCount(thresholds, norm=True) return v
def default_callback_loader(filename,l_edges): """ Default ensemble loader: reads a FITS data file containing a convergence map and measures its power spectrum :param args: A dictionary that contains all the relevant parameters as keys. Must have a "map_id" key :type args: Dictionary :returns: ndarray of the measured statistics :raises: AssertionError if the input dictionary doesn't have the required keywords """ logging.debug("Processing {0} power".format(filename)) conv_map = ConvergenceMap.load(filename,format=load_fits_default_convergence) l,Pl = conv_map.powerSpectrum(l_edges) return Pl
def default_callback_loader(filename, l_edges): """ Default ensemble loader: reads a FITS data file containing a convergence map and measures its power spectrum :param args: A dictionary that contains all the relevant parameters as keys. Must have a "map_id" key :type args: Dictionary :returns: ndarray of the measured statistics :raises: AssertionError if the input dictionary doesn't have the required keywords """ logging.debug("Processing {0} power".format(filename)) conv_map = ConvergenceMap.load(filename, format=load_fits_default_convergence) l, Pl = conv_map.powerSpectrum(l_edges) return Pl
def convergence_measure_all(filename, index, fits_loader=None): """ Measures all the statistical descriptors of a convergence map as indicated by the index instance """ logging.debug("Processing {0}".format(filename)) #Load the map if fits_loader is not None: conv_map = ConvergenceMap.load(filename, format=fits_loader) else: conv_map = ConvergenceMap.load(filename, format=load_fits_default_convergence) #Allocate memory for observables descriptors = index observables = np.zeros(descriptors.size) #Measure descriptors as directed by input for n in range(descriptors.num_descriptors): if type(descriptors[n]) == PowerSpectrum: l, observables[descriptors[n].first:descriptors[n]. last] = conv_map.powerSpectrum( descriptors[n].l_edges) elif type(descriptors[n]) == Moments: observables[descriptors[n].first:descriptors[n]. last] = conv_map.moments( connected=descriptors[n].connected) elif type(descriptors[n]) == Peaks: v, observables[descriptors[n].first:descriptors[n]. last] = conv_map.peakCount( descriptors[n].thresholds, norm=descriptors[n].norm) elif type(descriptors[n]) == PDF: v, observables[descriptors[n].first:descriptors[n]. last] = conv_map.pdf(descriptors[n].thresholds, norm=descriptors[n].norm) elif type(descriptors[n]) == MinkowskiAll: v, V0, V1, V2 = conv_map.minkowskiFunctionals( descriptors[n].thresholds, norm=descriptors[n].norm) observables[descriptors[n].first:descriptors[n].last] = np.hstack( (V0, V1, V2)) elif type(descriptors[n]) == MinkowskiSingle: raise ValueError( "Due to computational performance you have to measure all Minkowski functionals at once!" ) else: raise ValueError( "Measurement of this descriptor not implemented!!!") #Return return observables