ladisk / LDAQ

MIT License
24 stars 5 forks source link

LDAQ - Streamlined Data Acquisition and Generation

What is LDAQ?

LDAQ stands for L\ ightweight D\ ata A\ c\ Q\ uisition, a Python-based toolkit designed to make data collection seamless and efficient. Whether you're a researcher, engineer, or hobbyist, LDAQ offers a powerful yet user-friendly platform to gather data from a wide range of hardware sources.

.. image:: /docs/source/images/FRF_visualization.gif :alt: frf_visualization

Key Features:

Getting started

Dive into the world of efficient data acquisition with LDAQ. Our documentation <https://ldaq.readthedocs.io/en/latest>_ will guide you through installation, setup, and basic usage to get you up and running in no time.

.. image:: /docs/source/images/getting_started.gif :alt: demo_gif

Installation

The package can be installed from PyPI using pip:

.. code-block::

pip install LDAQ

Create the acquisition object

The first step to starting the measurement is to create an acquisition object. Depending on your measurement hardware, you can select the appropriate acquisition class.

In this example, we use the LDAQ.national_instruments.NIAcquisition class, which is a wrapper for the National Instruments DAQmx driver. The class accepts the name of the input task as an argument:

.. code-block:: python

acq = LDAQ.national_instruments.NIAcquisition(input_task_name, acquisition_name='DataSource')

If the acquisition_name argument is not specified, the name of the acquisition object will be set to the value of input_task_name.

The acquisition_name argument is important when using multiple acquisition objects in the same measurement, and when specifying the layout of the live visualization <https://ldaq.readthedocs.io/en/latest/visualization.html>_.

Create the Core object

The acq object can now be added to the LDAQ.Core class:

.. code-block:: python

ldaq = LDAQ.Core(acq)

.. note::

To add live visualization of the measurement, the visualization object can be added to the ``LDAQ.Core`` object:

.. code-block:: python

    ldaq = LDAQ.Core(acq, visualization=vis)

Read how to prepare the ``vis`` object in the `visualization <https://ldaq.readthedocs.io/en/latest/visualization.html>`_ section.

Set the trigger

Often the measurement is started when one of the signal excedes a certain level. This can be achieved by setting the trigger on one of the data sources by calling the set_trigger method:

.. code-block:: python

ldaq.set_trigger(
    source='DataSource',
    level=100,
    channel=0, 
    duration=11, 
    presamples=10
)

Where:

.. note::

The ``LDAQ.Core`` may seem unnecessary when using a single acquisition source.
However, it enables the simultaneous usage of signal `generation <https://ldaq.readthedocs.io/en/latest/generation.html>`_, live `visualization <https://ldaq.readthedocs.io/en/latest/visualization.html>`_ 
and `multiple acquisition/generation <https://ldaq.readthedocs.io/en/latest/multiple_sources.html>`_ sources.

Run the measurement

The measurement can now be started by calling the run method:

.. code-block:: python

ldaq.run()

Save the measurement

After the measurement is completed, the data can be saved by calling:

.. code-block:: python

ldaq.save_measurement(
    name='my_measurement',
    root=path_to_save_folder,
    timestamp=True,
    comment='my comment'
)

Where:

What else can I do with LDAQ?