def findTracks(pipeline, rad_var="error_x", multiplier="2.0", nFrames=20): import PYME.Analysis.DeClump.deClump as deClump if rad_var == "1.0": delta_x = 0 * pipeline.mapping["x"] + multiplier else: delta_x = multiplier * pipeline.mapping[rad_var] clumpIndices = deClump.findClumps( pipeline.mapping["t"].astype("i"), pipeline.mapping["x"].astype("f4"), pipeline.mapping["y"].astype("f4"), delta_x.astype("f4"), nFrames, ) numPerClump, b = np.histogram(clumpIndices, np.arange(clumpIndices.max() + 1.5) + 0.5) trackVelocities = calcTrackVelocity(pipeline.mapping["x"], pipeline.mapping["y"], clumpIndices) # print b pipeline.selectedDataSource.clumpIndices = -1 * np.ones(len(pipeline.selectedDataSource["x"])) pipeline.selectedDataSource.clumpIndices[pipeline.filter.Index] = clumpIndices pipeline.selectedDataSource.clumpSizes = np.zeros(pipeline.selectedDataSource.clumpIndices.shape) pipeline.selectedDataSource.clumpSizes[pipeline.filter.Index] = numPerClump[clumpIndices - 1] pipeline.selectedDataSource.trackVelocities = np.zeros(pipeline.selectedDataSource.clumpIndices.shape) pipeline.selectedDataSource.trackVelocities[pipeline.filter.Index] = trackVelocities pipeline.selectedDataSource.setMapping("clumpIndex", "clumpIndices") pipeline.selectedDataSource.setMapping("clumpSize", "clumpSizes") pipeline.selectedDataSource.setMapping("trackVelocity", "trackVelocities")
def findTracks(pipeline, rad_var='error_x', multiplier='2.0', nFrames=20): import PYME.Analysis.DeClump.deClump as deClump if rad_var == '1.0': delta_x = 0 * pipeline.mapping['x'] + multiplier else: delta_x = multiplier * pipeline.mapping[rad_var] clumpIndices = deClump.findClumps(pipeline.mapping['t'].astype('i'), pipeline.mapping['x'].astype('f4'), pipeline.mapping['y'].astype('f4'), delta_x.astype('f4'), nFrames) numPerClump, b = np.histogram(clumpIndices, np.arange(clumpIndices.max() + 1.5) + .5) trackVelocities = calcTrackVelocity(pipeline.mapping['x'], pipeline.mapping['y'], clumpIndices) #print b pipeline.selectedDataSource.clumpIndices = -1 * np.ones( len(pipeline.selectedDataSource['x'])) pipeline.selectedDataSource.clumpIndices[ pipeline.filter.Index] = clumpIndices pipeline.selectedDataSource.clumpSizes = np.zeros( pipeline.selectedDataSource.clumpIndices.shape) pipeline.selectedDataSource.clumpSizes[ pipeline.filter.Index] = numPerClump[clumpIndices - 1] pipeline.selectedDataSource.trackVelocities = np.zeros( pipeline.selectedDataSource.clumpIndices.shape) pipeline.selectedDataSource.trackVelocities[ pipeline.filter.Index] = trackVelocities pipeline.selectedDataSource.setMapping('clumpIndex', 'clumpIndices') pipeline.selectedDataSource.setMapping('clumpSize', 'clumpSizes') pipeline.selectedDataSource.setMapping('trackVelocity', 'trackVelocities')
# [email protected] # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ################ from pylab import * from PYME.Analysis.DeClump import deClump t = arange(0, 200, .02) print((len(t))) x = randn(10000) y = randn(10000) delta_x = .05*ones(x.shape) asg = deClump.findClumps(t.astype('i'), x.astype('f4'), y.astype('f4'), delta_x.astype('f4'), 2) print(asg)
# Copyright David Baddeley, 2012 # [email protected] # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ################ from pylab import * from PYME.Analysis.DeClump import deClump t = arange(0, 200, .02) print((len(t))) x = randn(10000) y = randn(10000) delta_x = .05 * ones(x.shape) asg = deClump.findClumps(t.astype('i'), x.astype('f4'), y.astype('f4'), delta_x.astype('f4'), 2) print(asg)