Code Monkey home page Code Monkey logo

msdanalyzer's Introduction

Jean-Yves TINEVEZ

BioImage Analyst and Core Facility manager @ Institut Pasteur, Paris

With minuscule exceptions, all the code I make is about scientific image analysis and data analysis.

trophy

Top Langs

tinevez' GitHub stats

Maintainer and author (with excellent friends and colleagues) of:

Mastodon (The scientific software for tracking cells and lineaging in large microscopy images, not the social network.)

TrackMate (code)

MaMuT (code)

LocalZProjector

DeProj

MSDanalyzer

msdanalyzer's People

Contributors

tinevez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

msdanalyzer's Issues

FitMSD

Hello,

first of all great program!
When fitting trajectories of shorter length (both simulated and actual measurements), however, I noticed a lot of negative diffusion coefficients and r² values (which both afaik shouldn't be possible) and dug into the code of fitMSD.
If I interpret it correctly, the program determines how many time points correspond to 25% of the longest trajectory in the pool in terms of length, and than applies that to all other curves for their linear fit evaluation. This seems counter intuitive, as it includes very uncertain points from the shorter curves. The output even says "fitting the first 25% of EACH curve", but then the program doesn't take into account all the NaN points in the MSD data.
This also leads to the following problem: when I have 100 tracks of length 8 each, the program will not fit any because they are all shortened to 1 point prior to fitting. If I add just one track of e.g. length 16 , then suddenly all tracks are properly fitted from point 2 to 16*0.25=4. See the issue?
Edit: And yes, I realize that 25% of points of 8 is not 3, but this is beside the point here

Next, there is also another problem in regard to averaging the fits for a global diffusion coefficient. When I include ALL tracks, the estimate is about right (with a simulation of short tracks). However, when I include only the ones with r²>0.6 or so, a lot of the lower diffusion coefficients are discarded due to bad fit, causing an inflated estimate of total D. Maybe this will be solved with the problem above, when the fit can properly choose points and a correct r² is calculated for selection.

I think I came up with a coded solution for the point selection of each curve (not too hard) and can add it per request if you see the problem in the same way.
However, I have no idea yet on how to deal with the negative D's or averaging in regards to low r2 so that the global mean is accurate, and what math says about the negative r2.

Thank you for reading.

fitMeanMSD has NaN values?

Hi, I have been trying to do MSD analysis, following parts of this manual and this tutorial. However, I am hitting a wall with NaN values:

Error using fit>iFit (line 232)
X, Y and WEIGHTS cannot have NaN values.

Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...

Error in msdanalyzer/fitMeanMSD (line 44)
[fo, gof] = fit(t, y, ft, 'Weights', w);

Error in MSD_a (line 63)
[fo, gof] = ma.fitMeanMSD;

My whole Matlab script (the error comes from the very last section % calculate diffusion coefficiency):

% housekeeping
addpath('C:\Users\...\MSD-a\Fiji.app\scripts' )

% import track

file_path_tracks = 'PEI_chan00_Tracks.xml';
tracks = importTrackMateTracks(file_path_tracks);
n_tracks = numel( tracks );
fprintf('Found %d tracks in the file.\n', n_tracks)

% remove Z set time scale

clipZ = true; % Remove Z coordinates, if you know you can.
scaleT = true; % Use physical time for T.
tracks = importTrackMateTracks(file_path_tracks, clipZ, scaleT);
tracks{1}(5, :)

[ tracks, md ] = importTrackMateTracks(file_path_tracks, ...
clipZ, scaleT);
md

% plot figure

figure
hold on
c = jet(n_tracks);
for s = 1 : n_tracks
x = tracks{s}(:, 2);
y = tracks{s}(:, 3);
plot(x, y, '.-', 'Color', c(s, :))
end
axis equal
xlabel( [ 'X (' md.spaceUnits ')' ] )
ylabel( [ 'Y (' md.spaceUnits ')' ] )


% MSD calculation
SPACE_UNITS = 'µm';
TIME_UNITS = 's';
ma = msdanalyzer(2, SPACE_UNITS, TIME_UNITS);
ma = ma.addAll(tracks);

disp(ma)
ma = ma.computeMSD;
ma.msd

% Plot MSD
figure
ma.plotMSD;

% weighted average

cla
ma.plotMeanMSD(gca, true)
mmsd = ma.getMeanMSD;
t = mmsd(:,1);
x = mmsd(:,2);
dx = mmsd(:,3) ./ sqrt(mmsd(:,4));
errorbar(t, x, dx, 'k')

% calculate diffusion coefficiency
[fo, gof] = ma.fitMeanMSD;
plot(fo)
ma.labelPlotMSD;
legend off

And my PEI_chan00_Tracks.xml as outputted from TrackMate on FIJI (sorry about the mess, GitHub doesn't allow attaching this format):

<?xml version="1.0" encoding="UTF-8"?>
<Tracks nTracks="1" spaceUnits="pixel" frameInterval="1.0" timeUnits="frame" generationDateTime="Fri, 31 Dec 2021 00:44:16" from="TrackMate v7.4.0">
  <particle nSpots="423">
    <detection t="0" x="243.91340860624987" y="342.884031899681" z="0.0" />
    <detection t="1" x="243.37191200945378" y="343.84266326207654" z="0.0" />
    <detection t="2" x="243.48862247307162" y="343.218811985051" z="0.0" />
    <detection t="3" x="243.80818393062617" y="342.71267505358526" z="0.0" />
    <detection t="4" x="244.6699589289865" y="341.1865422465219" z="0.0" />
    <detection t="5" x="243.99688189694" y="342.84752211349456" z="0.0" />
    <detection t="6" x="244.43138665612986" y="341.2458458716915" z="0.0" />
    <detection t="7" x="243.7580033763809" y="342.703188463087" z="0.0" />
    <detection t="8" x="244.00771996971704" y="342.4693247748605" z="0.0" />
    <detection t="9" x="244.06595144508702" y="342.82585001801306" z="0.0" />
    <detection t="10" x="243.55139707604897" y="343.38607994076096" z="0.0" />
    <detection t="11" x="244.11812957910607" y="342.3975326136204" z="0.0" />
    <detection t="12" x="243.7032778050904" y="343.69995490156924" z="0.0" />
    <detection t="13" x="244.16351365918496" y="342.54552482997155" z="0.0" />
    <detection t="14" x="244.22296231027093" y="343.35102540893917" z="0.0" />
    <detection t="15" x="243.56937742908158" y="342.7292821795872" z="0.0" />
    <detection t="16" x="244.00725527325406" y="343.22039752649897" z="0.0" />
    <detection t="17" x="243.7257164924326" y="342.6726444680566" z="0.0" />
    <detection t="18" x="244.36271031200394" y="341.55902913192915" z="0.0" />
    <detection t="19" x="244.0070180504403" y="342.7024811909327" z="0.0" />
    <detection t="20" x="243.99443275048745" y="342.889222949332" z="0.0" />
    <detection t="21" x="244.32595064823605" y="342.26326222073084" z="0.0" />
    <detection t="22" x="243.44424186204208" y="343.5480510031946" z="0.0" />
    <detection t="23" x="243.62705348186304" y="343.5302002076695" z="0.0" />
    <detection t="24" x="243.0827673351158" y="344.4293294897878" z="0.0" />
    <detection t="25" x="244.54959582859496" y="343.5271224995209" z="0.0" />
    <detection t="26" x="244.62408731620184" y="342.24025470757766" z="0.0" />
    <detection t="27" x="244.09759839536667" y="341.33440261887415" z="0.0" />
    <detection t="28" x="244.13272086462143" y="341.640870597733" z="0.0" />
    <detection t="29" x="244.11298201756682" y="342.2039462260154" z="0.0" />
    <detection t="30" x="243.83895207803724" y="342.47518785145866" z="0.0" />
    <detection t="31" x="243.86338880659605" y="343.1416087910114" z="0.0" />
    <detection t="32" x="244.9599622443296" y="340.28742770646824" z="0.0" />
    <detection t="33" x="243.68650961482882" y="341.9145482846327" z="0.0" />
    <detection t="34" x="243.71983035668694" y="343.32090240539" z="0.0" />
    <detection t="35" x="243.89153299978483" y="344.28990442720453" z="0.0" />
    <detection t="36" x="243.24093289957074" y="344.2709193016204" z="0.0" />
    <detection t="37" x="243.64701918583182" y="341.30948539943284" z="0.0" />
    <detection t="38" x="244.51406358447684" y="342.1814466747606" z="0.0" />
    <detection t="39" x="244.83535200947853" y="341.981446879541" z="0.0" />
    <detection t="40" x="244.22074709220644" y="342.6533580101045" z="0.0" />
    <detection t="41" x="243.50262269398482" y="343.58804916605345" z="0.0" />
    <detection t="42" x="244.20315448630978" y="342.12156298310606" z="0.0" />
    <detection t="43" x="243.31249731034987" y="343.01525511410995" z="0.0" />
    <detection t="44" x="243.64048051250032" y="343.3213979630938" z="0.0" />
    <detection t="45" x="244.5433492876832" y="341.3119268815028" z="0.0" />
    <detection t="46" x="244.37180790350288" y="342.24346868147586" z="0.0" />
    <detection t="47" x="244.0410472363703" y="342.0807734829141" z="0.0" />
    <detection t="48" x="245.26435436532822" y="341.16419790663167" z="0.0" />
    <detection t="49" x="244.90434680894606" y="342.234438690088" z="0.0" />
    <detection t="50" x="244.17662754575892" y="342.30503838348596" z="0.0" />
    <detection t="51" x="244.14915332202622" y="342.1311456096883" z="0.0" />
    <detection t="52" x="244.21695010871542" y="341.743029702457" z="0.0" />
    <detection t="53" x="243.6689339399493" y="343.24544903408713" z="0.0" />
    <detection t="54" x="243.48164973157463" y="343.810607707057" z="0.0" />
    <detection t="55" x="244.6520331999213" y="340.84934651624474" z="0.0" />
    <detection t="56" x="244.76133528173045" y="340.9056626323231" z="0.0" />
    <detection t="57" x="244.529132869555" y="342.60600650064447" z="0.0" />
    <detection t="58" x="244.4031216414121" y="341.51602427293346" z="0.0" />
    <detection t="59" x="243.97934449190836" y="341.9516265374781" z="0.0" />
    <detection t="60" x="244.1974885748928" y="342.36624323964094" z="0.0" />
    <detection t="61" x="244.54365377002205" y="341.57703017904083" z="0.0" />
    <detection t="62" x="243.1959057081634" y="343.04636901180476" z="0.0" />
    <detection t="63" x="243.0842330131855" y="342.15245958160597" z="0.0" />
    <detection t="64" x="243.83377561688" y="342.58059298210804" z="0.0" />
    <detection t="65" x="244.21449600473989" y="342.2684754965984" z="0.0" />
    <detection t="66" x="244.32856982758508" y="341.6833165992277" z="0.0" />
    <detection t="67" x="243.09036640915792" y="344.269179878661" z="0.0" />
    <detection t="68" x="244.51735435055917" y="341.78803984394983" z="0.0" />
    <detection t="69" x="242.7334103407636" y="343.5298890299723" z="0.0" />
    <detection t="70" x="245.20958619299356" y="341.5377079436816" z="0.0" />
    <detection t="71" x="244.25033690718467" y="343.4754524545308" z="0.0" />
    <detection t="72" x="243.988036766094" y="342.79558528580606" z="0.0" />
    <detection t="73" x="244.09902513587528" y="343.1952247218019" z="0.0" />
    <detection t="74" x="245.03380372112719" y="341.9053055825794" z="0.0" />
    <detection t="75" x="243.94692399028904" y="342.9198037000831" z="0.0" />
    <detection t="76" x="244.96976711539253" y="341.66184562242364" z="0.0" />
    <detection t="77" x="244.87968330053044" y="342.184166560177" z="0.0" />
    <detection t="78" x="243.66178856486667" y="342.40058136245574" z="0.0" />
    <detection t="79" x="244.73549350331075" y="342.7775619176628" z="0.0" />
    <detection t="80" x="245.10384645644984" y="341.5552664972483" z="0.0" />
    <detection t="81" x="243.98799741658425" y="343.9387784640773" z="0.0" />
    <detection t="82" x="243.8532641352346" y="342.9913580307215" z="0.0" />
    <detection t="83" x="244.5388677482134" y="341.7338595715441" z="0.0" />
    <detection t="84" x="244.27205555957516" y="342.7218200930488" z="0.0" />
    <detection t="85" x="243.81355445839603" y="343.0928886774595" z="0.0" />
    <detection t="86" x="243.49917200724155" y="341.4052904073161" z="0.0" />
    <detection t="87" x="244.70504013147814" y="341.34788132965275" z="0.0" />
    <detection t="88" x="243.78182408522167" y="343.347807515264" z="0.0" />
    <detection t="89" x="243.69856745189372" y="342.8115798972077" z="0.0" />
    <detection t="90" x="243.99061084014028" y="340.41826956882494" z="0.0" />
    <detection t="91" x="244.3524409610545" y="342.27472702129046" z="0.0" />
    <detection t="92" x="243.8184862514945" y="343.52285399769994" z="0.0" />
    <detection t="93" x="244.19580728765902" y="342.62521139475103" z="0.0" />
    <detection t="94" x="243.77064339999075" y="342.27298212444066" z="0.0" />
    <detection t="95" x="244.37434126346463" y="342.342245021982" z="0.0" />
    <detection t="96" x="243.78502906135307" y="343.2110770867522" z="0.0" />
    <detection t="97" x="243.5922284262749" y="342.7702658067456" z="0.0" />
    <detection t="98" x="244.03114582910317" y="341.90524721216104" z="0.0" />
    <detection t="99" x="243.58504072285814" y="342.31048667785655" z="0.0" />
    <detection t="100" x="243.65669945328887" y="342.48756961098394" z="0.0" />
    <detection t="101" x="243.7124667365678" y="342.87432481878676" z="0.0" />
    <detection t="102" x="243.9331004565169" y="342.4867682651395" z="0.0" />
    <detection t="103" x="243.8862205814322" y="343.1931085333094" z="0.0" />
    <detection t="104" x="243.53970323260276" y="342.79361388159504" z="0.0" />
    <detection t="105" x="242.87401303345064" y="342.79329667143895" z="0.0" />
    <detection t="106" x="244.00335067647285" y="342.6324893771325" z="0.0" />
    <detection t="107" x="244.18555279227343" y="343.20417942261" z="0.0" />
    <detection t="108" x="244.75173502648218" y="342.65650931635054" z="0.0" />
    <detection t="109" x="243.83231691640356" y="343.19682348428927" z="0.0" />
    <detection t="110" x="244.79475871185764" y="341.504197210704" z="0.0" />
    <detection t="111" x="243.69157551238675" y="342.7109216318799" z="0.0" />
    <detection t="112" x="243.88116408133" y="341.49668453028386" z="0.0" />
    <detection t="113" x="243.18031069817965" y="343.0738870849031" z="0.0" />
    <detection t="114" x="243.93273019621145" y="342.37021922341984" z="0.0" />
    <detection t="115" x="244.41690158044608" y="343.15277893923707" z="0.0" />
    <detection t="116" x="243.31966586100762" y="343.5883955360841" z="0.0" />
    <detection t="117" x="243.92944667900957" y="342.96857307295255" z="0.0" />
    <detection t="118" x="243.61110871712992" y="343.18327046202324" z="0.0" />
    <detection t="119" x="243.7607476525357" y="342.06016719156815" z="0.0" />
    <detection t="120" x="244.39138214501165" y="342.3707241411568" z="0.0" />
    <detection t="121" x="243.6123368214537" y="343.18949327817506" z="0.0" />
    <detection t="122" x="244.48105585733893" y="342.6377821441258" z="0.0" />
    <detection t="123" x="244.0891670416133" y="342.4788747396938" z="0.0" />
    <detection t="124" x="243.7893198799499" y="341.2012813571606" z="0.0" />
    <detection t="125" x="243.13651493051972" y="342.59266569193653" z="0.0" />
    <detection t="126" x="244.00754284961965" y="342.1371790996892" z="0.0" />
    <detection t="127" x="243.7461115888613" y="343.34466069831154" z="0.0" />
    <detection t="128" x="243.97207871724495" y="342.923882443868" z="0.0" />
    <detection t="129" x="243.4800760705681" y="343.7862769636631" z="0.0" />
    <detection t="130" x="243.67886875246623" y="343.23894919473963" z="0.0" />
    <detection t="131" x="244.2659793350271" y="340.446509655625" z="0.0" />
    <detection t="132" x="242.75136084996146" y="343.6603593040879" z="0.0" />
    <detection t="133" x="243.40519776935645" y="343.18745621596315" z="0.0" />
    <detection t="134" x="243.8602092563097" y="341.2546376875875" z="0.0" />
    <detection t="135" x="244.45286502286743" y="342.30852161554816" z="0.0" />
    <detection t="136" x="244.06004070121108" y="342.83072759002494" z="0.0" />
    <detection t="137" x="243.48674448714237" y="341.6207053342686" z="0.0" />
    <detection t="138" x="243.8754329060689" y="341.7038490128814" z="0.0" />
    <detection t="139" x="244.29726518275066" y="342.71993617386727" z="0.0" />
    <detection t="140" x="243.45475969984736" y="342.3839962548006" z="0.0" />
    <detection t="141" x="245.25269584286187" y="342.41287602597424" z="0.0" />
    <detection t="142" x="243.96256880304088" y="343.26921552396703" z="0.0" />
    <detection t="143" x="243.54634935949372" y="343.30089929092765" z="0.0" />
    <detection t="144" x="244.03428477003158" y="342.59485345699994" z="0.0" />
    <detection t="145" x="244.39094869100992" y="341.7834697153699" z="0.0" />
    <detection t="146" x="244.49163744890748" y="341.8614351471927" z="0.0" />
    <detection t="147" x="244.7791015895681" y="341.17336202658083" z="0.0" />
    <detection t="148" x="243.28990399160597" y="342.081770053412" z="0.0" />
    <detection t="149" x="243.31774848151179" y="342.47179068230844" z="0.0" />
    <detection t="150" x="244.11591700404819" y="343.75215117681876" z="0.0" />
    <detection t="151" x="243.83287390583914" y="342.605222839501" z="0.0" />
    <detection t="152" x="244.07630781801222" y="342.8017645815374" z="0.0" />
    <detection t="153" x="244.21228441923628" y="342.1219915392759" z="0.0" />
    <detection t="154" x="243.5339974892303" y="342.67925699189993" z="0.0" />
    <detection t="155" x="243.97445264025188" y="342.35323099393315" z="0.0" />
    <detection t="156" x="244.25532983133184" y="342.75508991911977" z="0.0" />
    <detection t="157" x="243.85972783129097" y="341.67667062050555" z="0.0" />
    <detection t="158" x="244.1766631791401" y="342.38569856063776" z="0.0" />
    <detection t="159" x="242.65056235341547" y="344.09530990020886" z="0.0" />
    <detection t="160" x="243.93262349391026" y="341.9632019184528" z="0.0" />
    <detection t="161" x="244.26085747436636" y="342.07088112353676" z="0.0" />
    <detection t="162" x="244.576436396957" y="341.8875205663469" z="0.0" />
    <detection t="163" x="244.61588049529126" y="341.30594552034734" z="0.0" />
    <detection t="164" x="244.01356835528577" y="343.598374630768" z="0.0" />
    <detection t="165" x="244.00277772433392" y="341.95460077708105" z="0.0" />
    <detection t="166" x="244.44000006855993" y="342.4274075685272" z="0.0" />
    <detection t="167" x="244.52871964529186" y="342.431158875548" z="0.0" />
    <detection t="168" x="243.95272498357" y="340.80499123218743" z="0.0" />
    <detection t="169" x="244.49099042197906" y="342.37444199355514" z="0.0" />
    <detection t="170" x="244.8503079782891" y="341.0733563987545" z="0.0" />
    <detection t="171" x="244.4026006024286" y="341.36301332739464" z="0.0" />
    <detection t="172" x="244.1083208071712" y="341.8880067459057" z="0.0" />
    <detection t="173" x="244.40014175133138" y="341.4918946714053" z="0.0" />
    <detection t="174" x="244.4074249665167" y="341.39849002222303" z="0.0" />
    <detection t="175" x="243.65095121023802" y="343.23689202982115" z="0.0" />
    <detection t="176" x="244.19726952188486" y="342.3260638626879" z="0.0" />
    <detection t="177" x="244.99386837651164" y="341.8355982098644" z="0.0" />
    <detection t="178" x="244.87602057159853" y="342.83737258285555" z="0.0" />
    <detection t="179" x="244.25900080515703" y="342.72662853582716" z="0.0" />
    <detection t="180" x="243.8660456635342" y="342.48579503840875" z="0.0" />
    <detection t="181" x="244.33546915277793" y="342.5783639878837" z="0.0" />
    <detection t="182" x="244.09291507349826" y="341.2951466394404" z="0.0" />
    <detection t="183" x="243.79763565724778" y="342.7040901319229" z="0.0" />
    <detection t="184" x="243.9126410736268" y="343.22190705837255" z="0.0" />
    <detection t="185" x="243.9240718521019" y="341.50243536720086" z="0.0" />
    <detection t="186" x="244.1525407547283" y="343.15724802411626" z="0.0" />
    <detection t="187" x="245.35127284628993" y="341.5403896042332" z="0.0" />
    <detection t="188" x="243.82718927103178" y="343.1384498073379" z="0.0" />
    <detection t="189" x="243.57173597559637" y="343.7921845215232" z="0.0" />
    <detection t="190" x="243.7695920903639" y="343.11634244037396" z="0.0" />
    <detection t="191" x="245.22088202194604" y="341.33990721080073" z="0.0" />
    <detection t="192" x="244.9583883521766" y="341.43004406365833" z="0.0" />
    <detection t="193" x="244.03527278990742" y="342.4335072828263" z="0.0" />
    <detection t="194" x="244.01329866768197" y="342.8244171967862" z="0.0" />
    <detection t="195" x="243.5911217258679" y="343.7401346082835" z="0.0" />
    <detection t="196" x="243.4595889268096" y="341.8547172703083" z="0.0" />
    <detection t="197" x="244.16681902567944" y="342.2086080720939" z="0.0" />
    <detection t="198" x="243.79189517403677" y="341.80900267963364" z="0.0" />
    <detection t="199" x="243.97640753018788" y="342.75443297734506" z="0.0" />
    <detection t="200" x="243.22982351500707" y="342.2038807431261" z="0.0" />
    <detection t="201" x="243.60912762058683" y="341.85223533400045" z="0.0" />
    <detection t="202" x="243.68550036915295" y="342.7325857062062" z="0.0" />
    <detection t="203" x="244.30532404811035" y="341.6684353949809" z="0.0" />
    <detection t="204" x="243.5879485216657" y="343.13551870640623" z="0.0" />
    <detection t="205" x="243.14125554199813" y="342.1832975717731" z="0.0" />
    <detection t="206" x="243.72041678086154" y="341.7904919201363" z="0.0" />
    <detection t="207" x="243.65356573018786" y="343.34751555868445" z="0.0" />
    <detection t="208" x="243.8476804543635" y="341.95712290289987" z="0.0" />
    <detection t="209" x="244.11941014248453" y="342.0053434828735" z="0.0" />
    <detection t="210" x="243.4069636667843" y="341.08293440957004" z="0.0" />
    <detection t="211" x="243.80739757032785" y="340.85374007917636" z="0.0" />
    <detection t="212" x="244.03773907504578" y="340.90964026561574" z="0.0" />
    <detection t="213" x="244.17068177681242" y="340.8293883689112" z="0.0" />
    <detection t="214" x="243.73244614991523" y="343.34119468790925" z="0.0" />
    <detection t="215" x="244.45597198634206" y="341.2729775309307" z="0.0" />
    <detection t="216" x="243.8665017422282" y="343.4499521579972" z="0.0" />
    <detection t="217" x="243.5227628085193" y="342.5193217554694" z="0.0" />
    <detection t="218" x="244.26401647740423" y="343.3924268998538" z="0.0" />
    <detection t="219" x="243.77317015824045" y="342.47109908376" z="0.0" />
    <detection t="220" x="243.4408770504021" y="343.93580440810507" z="0.0" />
    <detection t="221" x="243.61882402562395" y="342.6602556017235" z="0.0" />
    <detection t="222" x="244.78346607920133" y="342.3017227508746" z="0.0" />
    <detection t="223" x="244.21387852089347" y="342.20512125718545" z="0.0" />
    <detection t="224" x="244.67838410813164" y="341.6777085121233" z="0.0" />
    <detection t="225" x="243.40279420948082" y="342.5609287585216" z="0.0" />
    <detection t="226" x="244.20561341179703" y="342.84862516409083" z="0.0" />
    <detection t="227" x="243.85040289109085" y="342.814936047266" z="0.0" />
    <detection t="228" x="243.8428051095688" y="342.5131790184941" z="0.0" />
    <detection t="229" x="244.2867267953085" y="340.1474317136585" z="0.0" />
    <detection t="230" x="243.83194849103828" y="343.2685025655878" z="0.0" />
    <detection t="231" x="243.82715462000613" y="342.831404723339" z="0.0" />
    <detection t="232" x="244.17899096601803" y="342.41372008892307" z="0.0" />
    <detection t="233" x="244.5790571959925" y="342.4467808684368" z="0.0" />
    <detection t="234" x="243.90771504049073" y="341.0052375661655" z="0.0" />
    <detection t="235" x="243.54090177243114" y="342.5451204291999" z="0.0" />
    <detection t="236" x="243.84608166460544" y="342.59376378464816" z="0.0" />
    <detection t="238" x="242.68801332274677" y="345.28795039741556" z="0.0" />
    <detection t="239" x="243.48881996602827" y="342.48802536970777" z="0.0" />
    <detection t="240" x="242.75742411131577" y="343.26360248142214" z="0.0" />
    <detection t="241" x="243.99565060395867" y="342.6932831227367" z="0.0" />
    <detection t="242" x="242.90257156670273" y="342.96371336698957" z="0.0" />
    <detection t="243" x="244.38372811494085" y="343.48112204257217" z="0.0" />
    <detection t="244" x="244.36106177611376" y="342.022314341895" z="0.0" />
    <detection t="245" x="244.52213397437612" y="342.72009151877586" z="0.0" />
    <detection t="246" x="243.352288681213" y="342.4474636317599" z="0.0" />
    <detection t="247" x="243.6831971485601" y="343.20608672887016" z="0.0" />
    <detection t="248" x="243.79614078936544" y="342.9989505121543" z="0.0" />
    <detection t="249" x="244.0568634862462" y="342.0828985939355" z="0.0" />
    <detection t="250" x="244.7337222406053" y="341.1645159962176" z="0.0" />
    <detection t="251" x="243.19233367326694" y="344.07677837599937" z="0.0" />
    <detection t="252" x="243.69626312723486" y="342.328994685248" z="0.0" />
    <detection t="253" x="245.11932918083812" y="340.50168459363107" z="0.0" />
    <detection t="254" x="244.23197762228557" y="342.214942316703" z="0.0" />
    <detection t="255" x="244.4690157058266" y="342.0887961873523" z="0.0" />
    <detection t="256" x="243.36615678738528" y="344.06059715186507" z="0.0" />
    <detection t="257" x="244.69371643883377" y="340.74053150847556" z="0.0" />
    <detection t="258" x="244.13067650489128" y="341.20609016291695" z="0.0" />
    <detection t="259" x="243.890906325819" y="342.60494585560804" z="0.0" />
    <detection t="260" x="243.5823708879247" y="343.7718082120638" z="0.0" />
    <detection t="261" x="243.49680083760356" y="342.46848552278226" z="0.0" />
    <detection t="262" x="244.00577237447757" y="342.9760062843658" z="0.0" />
    <detection t="263" x="244.96399302781535" y="340.82624014147774" z="0.0" />
    <detection t="264" x="244.26281907506274" y="342.82460518080353" z="0.0" />
    <detection t="265" x="244.47344538785273" y="341.3426104868375" z="0.0" />
    <detection t="266" x="245.16989029346266" y="341.4553042949032" z="0.0" />
    <detection t="267" x="243.75951089959312" y="341.6804924096941" z="0.0" />
    <detection t="268" x="244.33468404950494" y="342.6873921031434" z="0.0" />
    <detection t="269" x="244.21095059282817" y="341.88216044863736" z="0.0" />
    <detection t="270" x="244.14266184012953" y="342.50762488492563" z="0.0" />
    <detection t="271" x="244.4157339997343" y="341.922098083413" z="0.0" />
    <detection t="272" x="243.6837672591101" y="343.10189618885397" z="0.0" />
    <detection t="273" x="244.92538928478723" y="341.41304321232536" z="0.0" />
    <detection t="274" x="243.24593172929625" y="342.3565755275834" z="0.0" />
    <detection t="275" x="243.56519979128788" y="342.3168785381863" z="0.0" />
    <detection t="276" x="244.0500752144194" y="342.2668979949546" z="0.0" />
    <detection t="277" x="243.42349713329082" y="341.7562643134804" z="0.0" />
    <detection t="278" x="243.42019274837335" y="342.88991875603045" z="0.0" />
    <detection t="279" x="244.1200477375553" y="342.43694152061687" z="0.0" />
    <detection t="280" x="244.4141508017694" y="342.8833658240946" z="0.0" />
    <detection t="281" x="242.86873943881128" y="343.46215863074485" z="0.0" />
    <detection t="282" x="244.06571963606862" y="341.7981258670276" z="0.0" />
    <detection t="283" x="244.381835423386" y="342.746542620995" z="0.0" />
    <detection t="284" x="242.979299671856" y="343.5400589874954" z="0.0" />
    <detection t="285" x="243.5118105409633" y="343.9239963843594" z="0.0" />
    <detection t="286" x="244.5645026710385" y="341.7998791450622" z="0.0" />
    <detection t="287" x="243.61098600509473" y="341.9079082981496" z="0.0" />
    <detection t="288" x="244.14964271302838" y="340.7094566340824" z="0.0" />
    <detection t="289" x="244.42593621902446" y="341.76228180560497" z="0.0" />
    <detection t="290" x="244.72350891924347" y="342.38293464515704" z="0.0" />
    <detection t="291" x="243.77205366207878" y="342.871719115871" z="0.0" />
    <detection t="292" x="243.95913530313845" y="342.1677323101139" z="0.0" />
    <detection t="293" x="244.51403541891892" y="341.3305491245965" z="0.0" />
    <detection t="294" x="243.851429661963" y="341.8492468773561" z="0.0" />
    <detection t="295" x="244.249787663575" y="342.2407445592217" z="0.0" />
    <detection t="296" x="243.5621852276741" y="343.57848008016083" z="0.0" />
    <detection t="297" x="243.61378589455055" y="343.172657610172" z="0.0" />
    <detection t="298" x="244.79103662831713" y="342.20069873924797" z="0.0" />
    <detection t="299" x="243.7095527905251" y="342.7009352465478" z="0.0" />
    <detection t="300" x="243.57480839489463" y="340.6610613391488" z="0.0" />
    <detection t="301" x="244.434603971032" y="342.30566764911913" z="0.0" />
    <detection t="302" x="244.00314376945968" y="341.9112819969903" z="0.0" />
    <detection t="303" x="244.2711798370843" y="343.6715252118184" z="0.0" />
    <detection t="304" x="244.8314179495765" y="340.20583609859585" z="0.0" />
    <detection t="305" x="243.98104799222625" y="343.3838970844967" z="0.0" />
    <detection t="306" x="244.50903372598205" y="342.96516804558905" z="0.0" />
    <detection t="307" x="245.1723734022332" y="341.78925629018664" z="0.0" />
    <detection t="308" x="243.60454599136074" y="343.63860564903626" z="0.0" />
    <detection t="309" x="242.86658566353762" y="343.9410954809222" z="0.0" />
    <detection t="310" x="244.13016882743167" y="341.83593767563036" z="0.0" />
    <detection t="311" x="243.60964668620872" y="342.8389347944353" z="0.0" />
    <detection t="312" x="243.7163483612423" y="342.4714599931169" z="0.0" />
    <detection t="313" x="244.04218527408997" y="342.65094610179625" z="0.0" />
    <detection t="314" x="243.97395211723293" y="343.86950673571704" z="0.0" />
    <detection t="315" x="243.66684078005636" y="343.7349205080597" z="0.0" />
    <detection t="316" x="243.07318472064136" y="342.0669440670113" z="0.0" />
    <detection t="317" x="243.77281754106542" y="341.59322752286334" z="0.0" />
    <detection t="318" x="243.74705688230202" y="342.19226840485436" z="0.0" />
    <detection t="319" x="244.04277368884183" y="341.947749152301" z="0.0" />
    <detection t="320" x="243.83506935276398" y="341.6363015897159" z="0.0" />
    <detection t="321" x="244.06394607310756" y="342.3073704900957" z="0.0" />
    <detection t="322" x="244.28415209240677" y="342.8730645035705" z="0.0" />
    <detection t="323" x="244.0016936369698" y="342.85280900350426" z="0.0" />
    <detection t="324" x="243.64628225340354" y="343.2943622445597" z="0.0" />
    <detection t="325" x="243.64491101752506" y="340.382078543182" z="0.0" />
    <detection t="326" x="243.47503053204295" y="343.574031971357" z="0.0" />
    <detection t="327" x="243.41105320954202" y="344.1447359143825" z="0.0" />
    <detection t="328" x="243.62830869070663" y="342.42240382145974" z="0.0" />
    <detection t="329" x="244.22303192624494" y="341.6475834004336" z="0.0" />
    <detection t="330" x="244.12782080297512" y="341.4541472679037" z="0.0" />
    <detection t="331" x="243.89727453417674" y="343.38366693672043" z="0.0" />
    <detection t="332" x="244.69512382775224" y="340.4589968788083" z="0.0" />
    <detection t="333" x="244.61322830119062" y="339.6776379855296" z="0.0" />
    <detection t="334" x="243.7304380319593" y="342.22664373203514" z="0.0" />
    <detection t="335" x="243.60568450724836" y="341.6751723853535" z="0.0" />
    <detection t="336" x="243.81934437914498" y="343.64083645898563" z="0.0" />
    <detection t="337" x="243.8412499775233" y="343.155605737758" z="0.0" />
    <detection t="338" x="244.52070955540196" y="342.94816251727195" z="0.0" />
    <detection t="339" x="244.72274367579988" y="341.760260684095" z="0.0" />
    <detection t="340" x="244.2109664232425" y="341.227454281009" z="0.0" />
    <detection t="341" x="244.50424702161627" y="341.64670863138286" z="0.0" />
    <detection t="342" x="243.98696681637708" y="342.80043527355696" z="0.0" />
    <detection t="343" x="243.6169290020807" y="342.987189552959" z="0.0" />
    <detection t="344" x="244.31168299101742" y="341.8434203651287" z="0.0" />
    <detection t="345" x="243.45560025552658" y="343.26670628447874" z="0.0" />
    <detection t="346" x="243.61146934324987" y="343.5711669385198" z="0.0" />
    <detection t="347" x="243.83801976376046" y="342.96228816978845" z="0.0" />
    <detection t="348" x="242.9987448455195" y="344.4455437528835" z="0.0" />
    <detection t="349" x="244.53189004394736" y="342.0078766222082" z="0.0" />
    <detection t="350" x="244.34965344834637" y="343.02688623587517" z="0.0" />
    <detection t="351" x="243.8899311155621" y="343.3285175237478" z="0.0" />
    <detection t="352" x="244.59725347231222" y="342.0048286810631" z="0.0" />
    <detection t="353" x="243.52028104888703" y="344.47565287780327" z="0.0" />
    <detection t="354" x="244.29826473413237" y="342.8570633744583" z="0.0" />
    <detection t="355" x="244.30052144629457" y="342.99555539921687" z="0.0" />
    <detection t="356" x="243.70506807052263" y="343.0183113237741" z="0.0" />
    <detection t="357" x="243.28513596224477" y="343.8185131654382" z="0.0" />
    <detection t="358" x="244.24033217453552" y="340.56662412765445" z="0.0" />
    <detection t="359" x="243.2006970168961" y="344.420715387274" z="0.0" />
    <detection t="360" x="244.684150293526" y="341.8563535283276" z="0.0" />
    <detection t="361" x="242.79704753963534" y="345.3346461335017" z="0.0" />
    <detection t="362" x="245.1256494790178" y="340.7155555856981" z="0.0" />
    <detection t="363" x="243.43505644221293" y="343.52183602658016" z="0.0" />
    <detection t="364" x="243.76245677105868" y="342.6789073191635" z="0.0" />
    <detection t="365" x="244.36624707894734" y="341.00138964545346" z="0.0" />
    <detection t="366" x="243.48182126322845" y="343.34671295963653" z="0.0" />
    <detection t="367" x="244.36612799351553" y="342.97361896070953" z="0.0" />
    <detection t="368" x="244.28544615230507" y="343.0196835449454" z="0.0" />
    <detection t="369" x="243.9918391044588" y="341.9738751277761" z="0.0" />
    <detection t="370" x="244.356133617931" y="341.98960945024294" z="0.0" />
    <detection t="371" x="244.17931472470275" y="342.16236923575025" z="0.0" />
    <detection t="372" x="244.38692184359687" y="341.8314572170186" z="0.0" />
    <detection t="373" x="243.65087773472203" y="342.59138919263756" z="0.0" />
    <detection t="374" x="244.57459854795192" y="341.63940523898384" z="0.0" />
    <detection t="375" x="245.07225857645057" y="341.2326181071784" z="0.0" />
    <detection t="376" x="244.22871353067043" y="341.7128310917319" z="0.0" />
    <detection t="377" x="243.46798496748812" y="343.21456788011784" z="0.0" />
    <detection t="378" x="243.49524237527018" y="343.19985814898024" z="0.0" />
    <detection t="379" x="244.3319616508302" y="341.34411440741684" z="0.0" />
    <detection t="380" x="244.26849286041625" y="340.8826798204739" z="0.0" />
    <detection t="381" x="243.69694698628834" y="343.80897169165434" z="0.0" />
    <detection t="382" x="243.05531790117837" y="343.0496816951775" z="0.0" />
    <detection t="383" x="245.22933627814572" y="342.098178283379" z="0.0" />
    <detection t="384" x="244.1773775615671" y="342.0866793186716" z="0.0" />
    <detection t="385" x="244.05381386437188" y="343.1986540072997" z="0.0" />
    <detection t="386" x="244.39408135404767" y="343.0590385164544" z="0.0" />
    <detection t="387" x="244.029849787628" y="341.799236633735" z="0.0" />
    <detection t="388" x="244.41273898106763" y="342.9297465071306" z="0.0" />
    <detection t="389" x="243.38574793216543" y="343.89761570768064" z="0.0" />
    <detection t="390" x="244.80173685047862" y="342.34157096869154" z="0.0" />
    <detection t="391" x="243.8999469257682" y="342.2077572230232" z="0.0" />
    <detection t="392" x="244.2191729615871" y="341.7426656523668" z="0.0" />
    <detection t="393" x="243.915328727274" y="344.06763353318195" z="0.0" />
    <detection t="394" x="243.4415543697379" y="343.98295208404966" z="0.0" />
    <detection t="395" x="244.51336333169854" y="340.9535718045827" z="0.0" />
    <detection t="396" x="244.0578574443905" y="340.76423989781983" z="0.0" />
    <detection t="397" x="243.91245008403266" y="342.4466517945998" z="0.0" />
    <detection t="398" x="244.03217143811293" y="342.941214824612" z="0.0" />
    <detection t="399" x="244.1978782956599" y="343.04819686933433" z="0.0" />
    <detection t="400" x="243.73848748492992" y="342.6923449762576" z="0.0" />
    <detection t="401" x="243.89549270565465" y="342.41288249577525" z="0.0" />
    <detection t="402" x="244.2027325288378" y="342.31964117700846" z="0.0" />
    <detection t="403" x="244.52214352565608" y="342.2141644112634" z="0.0" />
    <detection t="404" x="244.16389875975014" y="342.82614102449804" z="0.0" />
    <detection t="405" x="244.25840167031296" y="342.9235744923958" z="0.0" />
    <detection t="406" x="243.915427504851" y="342.9676938303268" z="0.0" />
    <detection t="407" x="243.85979259116152" y="342.3909778085828" z="0.0" />
    <detection t="408" x="243.33502250187024" y="343.4487765289997" z="0.0" />
    <detection t="409" x="243.7338581741474" y="342.6558379785023" z="0.0" />
    <detection t="410" x="243.0183864691459" y="344.26253253042063" z="0.0" />
    <detection t="411" x="244.16996138307113" y="342.57292842666914" z="0.0" />
    <detection t="412" x="244.13527769590496" y="342.0666091951257" z="0.0" />
    <detection t="413" x="243.026431280147" y="342.424675183517" z="0.0" />
    <detection t="414" x="244.17478407619075" y="341.53275460008894" z="0.0" />
    <detection t="415" x="243.8382276918444" y="342.7102356575479" z="0.0" />
    <detection t="416" x="244.13947269149944" y="342.0957901406573" z="0.0" />
    <detection t="417" x="244.05220740421703" y="341.31859106947417" z="0.0" />
    <detection t="418" x="243.85793638400204" y="340.8446018674191" z="0.0" />
    <detection t="419" x="244.09058094003132" y="341.76507450664" z="0.0" />
    <detection t="420" x="244.73533480541968" y="341.2792053882503" z="0.0" />
    <detection t="421" x="243.58544871761143" y="342.9334984777053" z="0.0" />
    <detection t="422" x="243.431320056101" y="343.2301651661782" z="0.0" />
    <detection t="423" x="244.10975559275707" y="340.14118211428126" z="0.0" />
  </particle>
</Tracks>

Apologies in advance because this sounds like a rather trivial problem on the surface, but I am quite new to Matlab, and I have no clue how to even begin looking for these NaN values.

Missing frames

Hello,

Thank you for the great problem.
Can I make a suggestion? Currently, missing points must be removed by the user from the track list before loading it into msdanalyzer.
The data set I am working on has a NaN position for missing frames. At first I didn't realise this and it loads fine in msdanalyser and I can fit the mean msd curve but when I try to fit the individual curves, it fails due to individual curves having lots of NaNs (propagated from a single missing point by addition).

As another user may not realise the problem, I suggest adding
track=track(~isnan(track(:,2)),:);
after line 51 in computeMSD.m

Best,
Sean

unequal tracks

Hi,

I have this real movie with particles that I tracked with Trackmate. Some of the particles bleach or move in 3D so I have unequal track lengths. When I import the .csv into MATLAB to extract the tracks in the format ([ Ti Xi Yi ...]) as per your tutorial, I don't always have the same measurements per particles. Would the msdanalyzer still work or do I have to pad the data?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.