Note
Click here to download the full example code
Analyze Imported DataΒΆ
This example will guide you through the process of importing and analyzing data.
To import data and analyse it, we only need the Track
class.
from trait2d.analysis import Track
We can now import data from a .csv
file.
track = Track.from_file("track1.csv", unit_length='micrometres')
The track is now imported and can be used for analysis. The representation of the track instance holds some information about it.
track
Out:
<Track instance at 140668315412176>
------------------------
Track length: 1000
Track ID: None
------------------------
MSD calculated: False
MSD analysis done: False
ADC analysis done: False
To view the trajectory, we can use Track.plot_trajectory().
track.plot_trajectory()
from trait2d.analysis.models import ModelBrownian, ModelConfined, ModelHop
from trait2d.analysis import ModelDB
ModelDB().add_model(ModelBrownian)
ModelDB().add_model(ModelConfined)
ModelDB().add_model(ModelHop)
We can choose the range of data used for the fits with the keyword argument fractionFitPoints.
track.adc_analysis(fraction_fit_points = 0.15)
track.plot_adc_analysis_results()
Out:
0%| | 0/997 [00:00<?, ?it/s]
It is a good idea to use ModelDB().cleanup() at the end of your notebooks to remove all models again. Otherwise they may carry over into other open notebooks.
ModelDB().cleanup()
Total running time of the script: ( 0 minutes 1.189 seconds)