Code Monkey home page Code Monkey logo

caenreader's Introduction

CAENReader

A set of tools to read and process binary data produced by CAEN waveform digitizers.

Introduction

The binary format produced by CAEN digitizers (via WaveDump or similar DAQ software packages) is an efficient way of storing data. We have produced two classes, DataFile and RawTrigger, that parse the raw binary data, extract information from the event header, and return the recorded traces in numpy arrays. These can then be analyzed by the end user.

Contents

DataFile

This class is the connection to the raw binary data.

The getNextTrigger method is designed to be flexible and extract all information from the event header along with unpacking the traces into numpy arrays.

Zero Suppression and ZLE

CAEN provides two methods of suppressing extraneous information from being read out from the digitizers, Zero Suppression and Zero-length encoding (ZLE).

  • Zero Suppression: suppressing empty channels from being read out entirely
  • Zero-length encoding: only read out "interesting" parts of the acquisition window

These are documented in various digitizer manuals. Note, these features are not available for all models.

RawTrigger

This class is a container of the information stored in one trigger:

  • Trigger Time Tag (clock ticks from event header)
  • Time of event since beginning of the file (in microseconds)
  • Event Counter (from event header)
  • File position
  • Dictionary of the traces

There is one method, display, that uses matplotlib to plot the traces. The event information is displayed in a text box.

Usage

The most basic usage of this code is to extract a trigger from a binary file waves.dat and display the trigger using the trigger.display() method:

dataFile = CAENReader.DataFile('waves.dat')
trigger = dataFile.getNextTrigger()
trigger.display()

This will produce a plot of every trace included in this trigger. If zero suppression is being used, empty traces will not be plotted. For traces with ZLE, the "interesting" parts of the traces are plotted in their correct position.

The user is able to perform specific analysis on the traces as needed.

caenreader's People

Contributors

tlangfor avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

tsangares piovere

caenreader's Issues

16ch compatibility

getNextTrigger fails to accurately handle triggers with channels 8-15 in use on x725 boards.

Read fails when WaveDump is not saving headers

WaveDump alters the default data format in two ways. First, the traces are split into individual files, named wave#.dat. Then there is a user-defined option to include the event header, which is also in a different format (6 long words instead of 4, and different layout) from the default in the manual.

We will need to think about how best to alter the scope of this package to adapt to these quirks.

Trigger Time Stamp

Hi, I wrote a similar soft but in C++ (check it here)
I found it smart you have added the trigger time from the beginning of the file of an event. However, I see that your time from the beginning of the file (in us) is calculated by multiplying the trigger time tag (triggerTime member) by the value of 8e-3. But it is not correct for all CAEN digitizers. For example, for the 724 series it must be 10e-3, and for 742 series it must be 8.5e-3. At least according to the WaveDump manual. However, it would be better to refer to the board documentation. The same is for the rollover value that you use: it is not 231 for all CAEN digitizers.

failed attempt #1

I followed the instructions to extract the trigger:

dataFile = CAENReader.DataFile('waves.dat')
trigger = dataFile.getNextTrigger()
trigger.display()

But on the first step I get the following error:

name 'CAENReader' is not defined

I ensured that the .py file was in the same directory as I was in the terminal. I don't know what else could cause this error.

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.