Nanoparticle Tracking

Nanoparticle tracking is a technique that allows to measure the size of very small objects. The core idea is that by locating objects subject to brownian motion, it is possible to reconstruct their movement, which in turn can be fitted to a model which depends on properties of the medium (i.e. viscosity) and on the diameter of the particles.

Nanoparticle tracking analysis (NTA) is a common name used to the entire cycle of data acquisition, localization, and analysis. Commercial devices such as NanoSight and ZetaView provide a closed-solution to the problem. PyNTA aims at providing a superior approach, allowing researchers to have real-time information on the sample studied and a completely transparent approach regarding algorithms used.

copyright

Aquiles Carattino <aquiles@uetke.com>

license

GPLv3, see LICENSE for more details

class pynta.model.experiment.nanoparticle_tracking.np_tracking.NPTracking(filename=None)[source]

Bases: pynta.model.experiment.base_experiment.BaseExperiment

Experiment class for performing a nanoCET measurement.

BACKGROUND_NO_CORRECTION = 0
BACKGROUND_SINGLE_SNAP = 1
calculate_waterfall(image)[source]

A waterfall is the product of summing together all the vertical values of an image and displaying them as lines on a 2D image. It is how spectrometers normally work. A waterfall can be produced either by binning the image in the vertical direction directly at the camera, or by doing it in software. The first has the advantage of speeding up the readout process. The latter has the advantage of working with any camera. This method will work either with 1D arrays or with 2D arrays and will generate a stack of lines.

check_background()[source]

Checks whether the background is set.

clear_roi()[source]

Clears the region of interest and returns to the full frame of the camera.

empty_locations_queue()[source]

Empties the queue with location data.

empty_saver_queue()[source]

Empties the queue where the data from the movie is being stored.

finalize()[source]

Needs to be overridden by child classes.

initialize_camera()[source]

Initializes the camera to be used to acquire data. The information on the camera should be provided in the configuration file and loaded with load_configuration(). It will load the camera assuming it is located in nanoparticle_tracking/model/cameras/[model].

Todo

Define how to load models from outside of PyNTA. E.g. from a user-specified folder.

Starts linking the particles while the acquisition is in progress.

localize_particles_image(image=None)[source]

Localizes particles based on trackpy. It is a convenience function in order to use the configuration parameters instead of manually passing them to trackpy.

save_image()[source]

Saves the last acquired image. The file to which it is going to be saved is defined in the config.

save_stream()[source]

Saves the queue to a file continuously. This is an async function, that can be triggered before starting the stream. It relies on the multiprocess library. It uses a queue in order to get the data to be saved. In normal operation, it should be used together with add_to_stream_queue.

property save_stream_running
set_roi(X, Y)[source]

Sets the region of interest of the camera, provided that the camera supports cropping. All the technicalities should be addressed on the camera model, not in this method.

Parameters
  • X (list) – horizontal position for the start and end of the cropping

  • Y (list) – vertical position for the start and end of the cropping

Raises

ValueError – if either dimension of the cropping goes out of the camera total amount of pixels

Returns

The final cropping dimensions, it may be that the camera limits the user desires

snap()[source]

Snap a single frame.

snap_background()[source]

Snaps an image that will be stored as background.

start_free_run()[source]

Starts continuous acquisition from the camera, but it is not being saved. This method is the workhorse of the program. While this method runs on its own thread, it will broadcast the images to be consumed by other methods. In this way it is possible to continuously save to hard drive, track particles, etc.

start_linking_locations()[source]
start_saving_location()[source]
start_tracking()[source]

Starts the tracking of the particles

stop_free_run()[source]

Stops the free run by setting the _stop_event. It is basically a convenience method to avoid having users dealing with somewhat lower level threading options.

Stops the linking process.

stop_linking_locations()[source]
stop_save_stream()[source]

Stops saving the stream.

stop_saving_location()[source]
stop_tracking()[source]
sysexcept(exc_type, exc_value, exc_traceback)[source]
property temp_locations