Submodules

spt.analytic_expressions

Some analytic expressions used in other submodules, e.g. fitting functions, cdf, …

spt.analytic_expressions.ecdf(x)

Calculate experimental continuous distribution function (ECDF), i.e. no binning, of random variable x so that ECDF(value)=probability(x>=value). I.e first value of counts=1.

Equivalent to inverse of:
matplotlib.pyplot.hist(tau_dist,bins=numpy.unique(tau_dist),normed=True,cumulative=True) but with non-equidistant binning, but bins are chosen according to unique values in x.
Parameters:x (numpy.array) – 1 dimensional array of random variable
Returns:
  • [0](numpy.array): Bins of ECDF corresponding to unique values of x.
  • [1](numpy.array): ECDF(value)=probability(x>=value).
Return type:list
spt.analytic_expressions.exp_tracks_per_frame(x, a, b)

Exponential like decay to fit number of tracks per frame: NoTracks=a*np.exp(-x/b)+c

spt.analytic_expressions.gauss_1D(x, x0, sigma, A)

Simple 1D non-normalized Gaussian function: y=np.absolute(A)*np.exp(-(x-x0)**2/sigma**2)

spt.analytic_expressions.gauss_Ncomb(x, p, N)

Sum of N 1D Gaussian functions, see gauss_1D(x,x0,sigma,A). The nth Gaussian function with n in [0,N[ is:

  • centered at multiples of first Gaussian center (n+1)*x0
  • has a width of sqrt(n+1)*sigma assuming Poissonian broadening
  • but decoupled Amplitudes An
Parameters:
  • x (np.array) – Values at which function is evaluated
  • p (list) – [x0,sigma,A0,A1,...,AN] input parameters for sum of Gaussians (len=N+2)
  • N (integer) – Number of Gaussian functions that are summed up
Returns:

Evaluation of function at x, p, N

Return type:

np.array

spt.analytic_expressions.msd_anomal(tau, a, b)

MSD fitting eq. for anomalous diffusion: msd=a*tau**b According to: Carlo Manzo, Report on Progress in Physics, 78, 2015 (manzo)

spt.analytic_expressions.msd_free(tau, a, b=0)

MSD fitting eq. for simple brownian diffusion taking localization precision into account: msd=a*tau+b According to: Xavier Michalet, Physical Review E, 82, 2010 (michalet)

spt.analyze

Further evaluate (averaging, …) _tprops. or _tmobprops.hdf5 files, i.e. to generate end result of kinetic analysis.

spt.analyze.fit_Ncomb(x, y, centers_init, N)
spt.analyze.fit_levels(data, centers_init)
spt.analyze.fit_tracks_per_frame(n_tracks)

Fit number of trajectories per frame with deaying exponential

spt.analyze.get_NgT(df)

Return average and 25%/75% interquartile range of all NgT related values.

spt.analyze.get_T_with_N(df)

Return critical times of NgT

spt.analyze.get_half_time(df)

Get half life time, i.e. 1-ecdf (means bigger than T) of start times for different ignore values.

spt.analyze.get_mobile_props(df_in, infos, px, CycleTime, remove_immob=True)
spt.analyze.get_props(df)
Wrapper function to combine:
  • get_half_time(df)
spt.analyze.get_result(df, name)
spt.analyze.tracks_per_frame(props, NoFrames)

Count number of trajectories per frame.

spt.immobile_props

Kinetic properties of picks for immobilized samples, e.g. TPP, photons, binding events, …

spt.immobile_props.apply_props(df, ignore=1)

Group _picked.hdf5 by groups (i.e. picks in picasso.addon) and apply get_props() to each group to get immobile properties as in spt.

Parameters:
  • df (pandas.DataFrame) – Grouped localization list, i.e. _picked.hdf5 as in picasso.addon
  • ignore (int=1) – Maximum interruption (frames) allowed to be regarded as one bright time.
Returns:

Output of get_props() for each group in df (groupby-apply approach).

Return type:

pandas.DataFrame

spt.immobile_props.apply_props_dask(df, ignore=1)

Same as apply_props() but in parallelized version using DASK by partitioning df. Local DASK cluster has to be started manually for efficient computation, see cluster_setup_howto().

Parameters:
  • df (pandas.DataFrame) – Grouped localization list, i.e. _picked.hdf5 as in picasso.addon
  • ignore (int=1) – Maximum interruption (frames) allowed to be regarded as one bright time.
Returns:

Output of get_props() for each group in df (groupby-apply approach).

Return type:

pandas.DataFrame

spt.immobile_props.cluster_setup_howto()

Print instruction howto start a DASK local cluster for efficient computation of apply_props_dask(). Fixed scheduler_port=8787 is used to easily reconnect to cluster once it was started.

spt.immobile_props.filter_(df, NoFrames, apply_filter=None)

Decide which filter to apply to the output of get_props(), either:

  • ‘sd’ as given by filter_fix()
  • ‘th’ as given by filter_nofix()
  • ‘none’ if no filter should be applied
Parameters:
  • df (pandas.DataFrame) – Immobile properties as calulated by apply_props()
  • NoFrames (int) – Length of measurement in frames of corresponding raw movie.
  • apply_filter (str) – Either ‘sd’,’th’ or ‘none’. See above.
Returns:

Positives in df according to chosen filter as described above.

Return type:

pandas.DataFrame

spt.immobile_props.filter_fix(df)

Filter for immobilized single dye origami as described in spt. Positives are groups

  • with a trajectory within the first 5 frames after the start of the measurement
  • and number of trajectories within group lie in 90% interval of all groups
Parameters:df (pandas.DataFrame) – Immobile properties as calulated by apply_props()
Returns:Positives in df according to single dye filter as described above.
Return type:pandas.DataFrame
spt.immobile_props.filter_nofix(df, NoFrames)

Filter for immobilized origami with DNA-PAINT based tracking handle (TH) as described in spt. Positives are groups

  • with a trajectory within the first 5 frames after the start of the measurement
  • and number localizations within group are greater or equal to 20% of total measurement duration (in frames)
Parameters:df (pandas.DataFrame) – Immobile properties as calulated by apply_props()
Returns:Positives in df according to TH filter as described above.
Return type:pandas.DataFrame
spt.immobile_props.get_NgT(df, ignore=1)

Combine get_taubs() and tracks_greaterT() to return TPP as pd.Series for one group.

  • Input equivalent to get_taubs().
  • Output equivalent to tracks_greaterT()[0].

The function assumes that there is only one group in the localization list!

Parameters:
  • df (pandas.DataFrame) – Grouped localization list, i.e._picked.hdf5 as in picasso.addon
  • ignore (int=1) – Maximum interruption (frames) allowed to be regarded as one bright time.
Returns:

Index consists of a combination of one of the following letters and T in frames.

  • n: Number of tracks longer or equal to T, i.e. TPP as in spt
  • s: Mean 1st frame of tracks longer or equal to T.
  • p: Mean photons of tracks longer or equal to T.
  • e: Mean relative standard deviation of photons of tracks longer or equal to T.

Return type:

pandas.Series

spt.immobile_props.get_props(df, ignore=1)

Combination of get_NgT(df,ignore) and get_start(df,ignore) and get_var(df).

Parameters:
  • df (pandas.DataFrame) – Grouped localization list, i.e. _picked.hdf5 as in picasso.addon
  • ignore (int=1) – Maximum interruption (frames) allowed to be regarded as one bright time.
Returns:

Concatenated output of get_NgT(df,ignore) and get_start(df,ignore) and get_var(df).

Return type:

pandas.Series

spt.immobile_props.get_start(df, ignore)

For a list of ignore values, was there a bright time at the start of the measurement and of which duration? That means for

  • ignore=2 and the first bright time starting at frame=3 there was NO bright time
  • ignore=3 and the first bright time starting at frame=3 there was a bright time of finite duration.
Parameters:
  • df (pandas.DataFrame) – Grouped localization list, i.e. _picked.hdf5 as in picasso.addon
  • ignore (list) – List of maximum interruption (frames) allowed to be regarded as one bright time.
Returns:

Index has format Tstart-i%i'%(ignore). The value is the duration of the bright time at start of measurement if it happened within ignore.

Return type:

pandas.Series

spt.immobile_props.get_taubs(df, ignore=1)

Get bright time distribution, i.e. the intervals of continuous localizations only interrupted by ignore for one group and additional properties of each bright time. I.e. a bright time corresponds to one trajectory in terms of single particle tracking. The function assumes that there is only one group in the localization list!

Parameters:
  • df (pandas.DataFrame) – Grouped localization list, i.e._picked.hdf5 as in picasso.addon
  • ignore (int=1) – Maximum interruption (frames) allowed to be regarded as one bright time.
Returns:

  • [0](numpy.array): Bright times only interrupted by ignore
  • [1](numpy.array): 1st frame of each bright time
  • [2](numpy.array): Mean photon values of each bright time
  • [3](numpy.array): Relative standard deviation of photons of each bright time

Return type:

list

spt.immobile_props.get_trace(df, NoFrames, field='net_gradient')

Get continuous field vs. time trace of length=NoFrames for one group. The function assumes that there is only one group in the localization list!

Parameters:
  • df (pandas.DataFrame) – Grouped localization list, i.e. _picked.hdf5 as in picasso.addon
  • NoFrames (int) – Length of measurement in frames of corresponding raw movie.
  • field (str) – Column name in df, e.g. ‘photons’ for intensity vs. time trace.
Returns:

Trace, e.g. continuous field vs. time trace of length=NoFrames for one group

Return type:

numpy.array

spt.immobile_props.get_var(df)

Get various properties for one group in _picked.hdf5 as in picasso.addon.

Parameters:df (pandas.DataFrame) – Grouped localization list, i.e. _picked.hdf5 as in picasso.addon
Returns:Indices are means of all columns in df plus …
  • n_locs: Number of localizations
  • photons: Not mean but median!
  • std_photons: Standard deviation of photons.
  • bg: Background photons. Not mean but median!
  • sx: Standard deviation of group in x
  • sy: Standard deviation of group in y
  • min_frame: Mimimum in frames
  • max_frame: Maximum in frames
  • len: max_frame-min_frame (see above)
Return type:pandas.Series
spt.immobile_props.main(locs, info, path, **params)

Get immobile properties for each group in _picked.hdf5 file (see picasso.addon) and filter.

Parameters:
  • locs (pandas.DataFrame) – Grouped localization list, i.e. _picked.hdf5 as in picasso.addon
  • info (list) – Info _picked.yaml to _picked.hdf5 localizations as list of dictionaries.
  • path (str) – Path to _picked.hdf5 file.
Keyword Arguments:
 
  • ignore (int=1) – Maximum interruption (frames) allowed to be regarded as one bright time.
  • parallel (bool=True) – Apply parallel computing using DASK? Local cluster should be started before according to cluster_setup_howto()
  • filter (string='th') – Which filter to use, either None, ‘th’ or ‘sd’ or ‘none’
Returns:

  • [0](dict): Dict of keyword arguments passed to function.
  • [1](pandas.DataFrame): Immobile properties of each group in locs as calulated by apply_props()

Return type:

list

spt.immobile_props.tracks_greaterT(track_length, track_start, track_photons, track_photons_std)

Get number of trajectories (bright times) per particle (group or pick) greater or equal to T, i.e. TPP in spt. The function takes returns of get_taubs() as input.

Parameters:
  • track_length (numpy.array) – Trajectory durations or bright times only interrupted by ignore. See get_taubs().
  • track_start (numpy.array) – 1st frame of each trajectory. See get_taubs().
  • track_photons (numpy.array) – Mean photon values of each bright time. See get_taubs().
  • track_photons_std (numpy.array) – Relative standard deviation of photons of each bright time. See get_taubs().
Returns:

  • [0](pandas.Series): Index consists of a combination of one of the following letters and T in frames.

    • n: Number of tracks longer or equal to T, i.e. TPP as in spt
    • s: Mean 1st frame of tracks longer or equal to T.
    • p: Mean photons of tracks longer or equal to T.
    • e: Mean relative standard deviation of photons of tracks longer or equal to T.
  • [1](numpy.array): T in frames

Return type:

list

spt.linklocs

Linking of localizations into particle trajectories using trackpy.

spt.linklocs.drop_shorttracks(df, min_n_locs=10)

Remove trajectories with less localizations than min_n_locs from output of get_link().

Parameters:
  • df (pandas.DataFrame) – Trajectories pandas.DataFrame, i.e. output of get_link() (see also trackpy.link())
  • min_n_locs (int=10) – Trajectories having less localizations than min_n_locs will be removed from df
Returns:

df with short trajectories < min_n_locs removed.

Return type:

pandas.DataFrame

Apply trackpy.link_df() (trackpy) on localizations with given search_range and memory to get trajectories sorted by group and frame. All tracks shorter or equal to 10 frames are removed.

Parameters:
  • locs (pandas.DataFrame) – Localizations as generated by picasso.localize as pandas.DataFrame
  • info (picasso.io) – Info _locs.yaml to _locs.hdf5 localizations as list of dictionaries.
  • search_range (int) – Localizations within search_range (spatial) will be connected to tracks (see trackpy.link_df)
  • memory (int) – Localizations within memory (temporal) will be connected to tracks (see trackpy.link_df)
Returns:

Linked trajectories using trackpy.link().

  • group instead of particle column for picasso.render compatibility.
  • All trajectories with <= 10 localizations are already removed!!

Return type:

pandas.DataFrame

spt.linklocs.main(locs, info, path, **params)

Link localizations using trackpy.link_df() (trackpy) on localizations (picasso.localize) with given search_range and memory to get trajectories sorted by group and frame. All tracks shorter or equal to 10 frames are removed. Trajectories will be saved as '_picked%i%i.hdf5'%(search_range,memory) with corresponding info as .yaml.

Parameters:
  • locs (pandas.DataFrame) – Localization list, i.e. _locs.hdf5 as in picasso.localize
  • info (list) – Info _locs.yaml to _locs.hdf5 localizations as list of dictionaries.
  • path (str) – Path to _locs.hdf5 file.
Keyword Arguments:
 
  • search_range (int) – Localizations within search_range (spatial) will be connected to tracks (see trackpy.link_df)
  • memory (int) – Localizations within memory (temporal) will be connected to tracks (see trackpy.link_df)
Returns:

  • [0](dict): Dict of keyword arguments passed to function.
  • [1](pandas.DataFrame): Trajectories by application of trackpy.link_df(). See above.

Return type:

list

spt.linklocs.plot_scan_results(df, prox)

Quickly plot results in scan_sr_mem().

Parameters:
  • df (pandas.DataFrame) – Return DataFrame of scan_sr_mem()[0].
  • prox (float) – Return DataFrame of scan_sr_mem()[1].
spt.linklocs.scan_sr_mem(locs, info, path, sr, mem, roi=True, timewindow=True)

Quick scan using get_link() (trackpy) algorithm using tuples of search_ranges and memory over center ROI and starting time window of the video. Corresponding plot will be saved using plot_scan_results(). This is implemented in order to quickly estimate optimum linking parameters.

Parameters:
  • locs (pandas.DataFrame) – Localizations as generated by picasso.localize as pandas.DataFrame
  • info (picasso.io) – Info _locs.yaml to _locs.hdf5 localizations as list of dictionaries.
  • path (str) – Path to _locs.hdf5 file for saving output
  • sr (list(int)) – List of search_ranges to scan (see trackpy.link)
  • mem (list(int)) – List of memory values to scan (see trackpy.link)
  • roi (bool=True) – If True scan is performed on cropped video to center 200^2 px FOV
  • timewindow (bool=True) – If True scan is performed on first 300 frames of video only
Returns:

  • [0] (pandas.DataFrame): Multi-Index: Tuple (search_range, memory) with columns:

    • len_med: Median track length
    • numtracks: Number of linked tracks
    • search_range: See above
    • memory: See above
  • [1] (float):

    Proximity, i.e. 90% of all nearest neighbor distances between localizations corresponding to first 100 frames (full FOV) are greater than proximity (px).

Return type:

list

spt.mob_props

Kinetic properties of trajectories for of mobile samples, e.g. MSD caluclation and fitting, …

spt.mob_props.apply_props(df)

Group trajectories list (_pickedxxxx.hdf5) as obtained by linklocs.main() by groups (i.e. trajectories) and apply get_props() to each group to get mobile properties. See also spt.

Parameters:df (pandas.DataFrame) – Trajectories list (_pickedxxxx.hdf5) as obtained by linklocs.main()
Returns:Output of get_props() for each group in df (groupby-apply approach).
Return type:pandas.DataFrame
spt.mob_props.apply_props_dask(df)

Same as apply_props() but in parallelized version using DASK by partitioning df. Local DASK cluster has to be started manually for efficient computation, see cluster_setup_howto().

Parameters:df (pandas.DataFrame) – Trajectories list (_pickedxxxx.hdf5) as obtained by linklocs.main()
Returns:Output of get_props() for each group in df (groupby-apply approach).
Return type:pandas.DataFrame
spt.mob_props.fit_msd_anomal(lagtimes, msd)

Unweighted least square fit of invidual msd by anomalous model msd=a*lagtimes**b, see analytic_expressions.msd_anomal(). If there was less then two data-points or fit was not succesfull NaNs are returned as optimum parameters.

Parameters:
  • lagtimes (np.array) – Array of msd lagtimes
  • msd (np.array) – Mean square displacement (msd) at lagtimes
Returns:

Column a corresponds to slope, b corresponds to diffusion mode.

Return type:

pandas.Series

spt.mob_props.fit_msd_free(lagtimes, msd, offset=False)

Unweighted least square fit of invidual msd by linear model msd=a*lagtimes+b, see analytic_expressions.msd_free(), i.e. assuming free Browninan motion. If there was less then two data-points or fit was not succesfull NaNs are returned as optimum parameters.

Parameters:
  • lagtimes (np.array) – Array of msd lagtimes
  • msd (np.array) – Mean square displacement (msd) at lagtimes
  • offset (bool=False) – If True offset is used in linear fit model, if False
Returns:

Column a corresponds to slope, b corresponds to offset of linear function applied.

Return type:

pandas.Series

spt.mob_props.fit_msd_free_iterative(lagtimes, msd, max_it=5)

Unweighted least square fit of invidual msd by linear model msd=a*lagtimes+b in iterative manner to find optimum fitting range of msd according to: Xavier Michalet, Physical Review E, 82, 2010 (michalet). In first iteration msd is fitted up to a maximum lagtime of lag_max=0.5*Nmsd with Nmsd being the full msd length. Notice that motion_metrics.displacement_moments() calculates msd only up to Nmsd=0.25*N hence lag_max=0.125*N with Nbeing the full lenght of the trajectory. Then fitting range is updated according to rule lag_max=int(np.round(2+2.3*(b/a)**0.52)). For a detailed illustration please see SI of spt.

Parameters:
  • lagtimes (np.array) – Array of msd lagtimes
  • msd (np.array) – Mean square displacement (msd) at lagtimes
  • max_it (int=5) – Maximum number of iterations
Returns:

  • a slope of linear function applied.
  • b offset of linear function applied
  • p maximum lagtime up to which msd was fitted
  • max_it resulting number of iterations until convergence was achieved

Return type:

pandas.Series

spt.mob_props.get_props(df)

Combination of immobile_props.get_var(df) and getfit_moments(df).

Parameters:df (pandas.DataFrame) – Trajectories (_pickedxxxx.hdf5) as obtained by linklocs.main()
Returns:Concatenated output of immobile_props.get_var(df) and getfit_moments(df).
Return type:pandas.Series
spt.mob_props.getfit_moments(df)

Calculate msd of single trajectory using metrics.displacement_moments() and apply both linear iterative fitting according to fit_msd_free_iterative() and anomalous diffsuion model fitting using fit_msd_anomal() to msd.

Parameters:df (pandas.DataFrame) – Trajectories (_pickedxxxx.hdf5) as obtained by linklocs.main()
Returns:Concatenated output of fit_msd_free_iterative() and fit_msd_anomal().
  • a_iter slope of iterative linear fit
  • b_iter offset of iterative linear fit
  • p_iter maximum lagtime up to which msd was fitted for iterative linear fit
  • max_iter resulting number of iterations until convergence was achieved for iterative linear fit
  • a slope of anomalous fit
  • b diffusion mode of anomalous fit
Return type:pandas.Series
spt.mob_props.main(locs, info, path, **params)

Get mobile properties for each group in trajectories list (_pickedxxxx.hdf5) file as obtained by linklocs.main().

Parameters:
  • locs (pandas.DataFrame) – Trajectories list (_pickedxxxx.hdf5) as obtained by linklocs.main()
  • info (list) – Info _pickedxxxx.yaml to _pickedxxxx.hdf5 trajectories as list of dictionaries.
  • path (str) – Path to _pickedxxxx.hdf5 file.
Keyword Arguments:
 

parallel (bool=True) – Apply parallel computing using DASK? Local cluster should be started before according to cluster_setup_howto()

Returns:

  • [0](dict): Dict of keyword arguments passed to function.
  • [1](pandas.DataFrame): Mobile properties of each group in locs as calulated by apply_props()

Return type:

list

spt.motion_metrics

Numba optimized caluclation of motion metrics like MSD, MME, straightness, msd_ratio, …

spt.motion_metrics.displacement_moments

Numba optimized calulation of trajectory (t,x,y) moments. Calulation accounts for short gaps, i.e. missed localizations recovered by allowed memory values. Moments are only calulated up to maximum lag time of l_max = 0.25*N with N=len(t). Calulated moments are:

  • Mean square displacement (MSD)
  • Mean displacement moment of 4th order (MSD corresponds to 2nd order)
  • Mean maximal excursion of 2nd order (MME)
  • Mean maximal excursion of 4th order

MME is calculated according to: Vincent Tejedor, Biophysical Journal, 98, 7, 2010 (tejedor)

Parameters:
  • t (np.array) – time
  • x (np.array) – x-position
  • y (np.array) – y-position
Returns:

  • [:,0]: lag time
  • [:,1]: MSD
  • [:,2]: Mean displacement moment of 4th order
  • [:,3]: MME
  • [:,4]: Mean maximal excursion of 4th order

Return type:

np.array of size (l_max,5)

spt.motion_metrics.msd_ratio

MSD ratio (classifier H.) according to P. Kowalek, Physical Review E, 100, 2019 (kowalek).

Parameters:moments (np.array) – Return of displacement_moments(t,x,y)
Returns:MSD ratio
Return type:float
spt.motion_metrics.straightness

Straightness (classifier I.) according to P. Kowalek, Physical Review E, 100, 2019 (kowalek).

Parameters:
  • x (np.array) – x-positions of trajectory
  • y (np.array) – y-positions of trajectory
Returns:

Straightness

Return type:

float

spt.special

Some special functions, e.g. track splitting into subtrajectories, generation of track and diffusion maps, …

spt.special.apply_multiply_jumps(df, factor, segment, ratio)

Groupby apply approach of multiply_jumptimes(df,factor,segment,ratio) to each group in df.

Parameters:
  • df (pandas.DataFrame) – (Complete) linked localizations as returned by spt.mob_props.main() (pickedXXXX.hdf5 files)
  • factor (int) – Jumptime multiplication factor
  • segment (int) – Number of localizations within segments.
  • ratio (int) – Ratio of slowed down to normal segments (see above).
Returns:

Same as df but with modified jumptimes.

Return type:

df_mod (TYPE)

spt.special.assign_prop_to_picked(props, picked, field='a_iter')
spt.special.assign_subgroup(df, subN)

Splitting of supgroup (full trajectory ID) into subgroup (subtrajectory ID). Each subgroup splits the supgroup in chunks of subN, i.e. the subtrajectory duration. Subtrajectories with less then 10 localizations are dropped.

Parameters:
  • df (pandas.DataFrame) – One trajectory as returned by spt.mob_props.main() (i.e. one group in pickedXXXX.hdf5 files)
  • subN (int) – Maximum length of sub-trajectories
Returns:

Same as df but with one new column subgroup (subtrajectory ID) in chunks of subN. See also above.

Return type:

pandas.DataFrame

spt.special.get_trackmap(locs, fov, oversampling, field='assign_field')
spt.special.multiply_jumps(df, factor, segment, ratio)

Multiply jumps by sqrt(factor) such that segments will have a diffusion contant multiplied by factor. Segments number of localizations is given by segment. Ratio indicates how many segments are mutiplied, i.e. for ratio=2 every 2nd, for ratio=3 every third segment is multiplied.

Parameters:
  • df (pandas.DataFrame) – One trajectory as returned by spt.mob_props.main() (i.e. one group in pickedXXXX.hdf5 files)
  • factor (int) – Diffusion constant multiplication factor, i.e. jumps will mutliplied by sqrt(factor) !!
  • segment (int) – Number of localizations within segments.
  • ratio (int) – Ratio of multiplied to normal segments (see above).
Returns:

Same as df but with modified jumptimes.

Return type:

pandas.DataFrame

spt.special.multiply_jumptimes(df, factor, segment, ratio)

Multiply jumptimes by factor in segments. Segments number of localizations is given by segment. Ratio indicates how many segments are mutiplied, i.e. for ratio=2 every 2nd, for ratio=3 every third segment is multiplied leading to apparent slower diffusion within these segments.

Parameters:
  • df (pandas.DataFrame) – One trajectory as returned by spt.mob_props.main() (i.e. one group in pickedXXXX.hdf5 files)
  • factor (int) – Jumptime multiplication factor
  • segment (int) – Number of localizations within segments.
  • ratio (int) – Ratio of slowed down to normal segments (see above).
Returns:

Same as df but with modified jumptimes.

Return type:

pandas.DataFrame

spt.special.render_trackmap
spt.special.split_trajectories(df, subN)

Groupby apply approach of assign_subgroup(df,subN) to each group in df. Splits trajectories into shorter trajectories of length subN. Three new columns are assigned to give track ID:

supgroup: Super-group = group column of original subgroup: Sub-group = New trajectories of length subN or lower group: Unique new sub-group ID
Parameters:
  • df (pandas.DataFrame) – (Complete) linked localizations as returned by spt.mob_props.main() (pickedXXXX.hdf5 files)
  • subN (int) – Maximum length of sub-trajectories
Returns:

Same as df but with new columns indicating sup(er)- or subtrajectories. See above.

Return type:

pandas.DataFrame