adhoc

This module scope coves ADHOC files’ operations.

ADHOC files typically have the .AD2 (for two-dimensional data) and .AD3 (for tri-dimensional data).

It is based on a module provided by Benoît Epinat, and integrated into Tuna in 2015.

class tuna.io.adhoc.adhoc(adhoc_type=None, adhoc_trailer=None, file_name=None, array=None)[source]

This class’ responsibilities include: reading files in one of the ADHOC file formats (AD2 or AD3).

First implemented by Benoit Epinat from LAM. The ADHOC file formats were developed for use with the ADHOC software solution, developed at LAM by Jacques Boulesteix.

It inherits from file_reader.

Its constructor has the following signature:

Parameters:

  • adhoc_type : int : defaults to None.

    Valid types are 2 and 3.

  • adhoc_trailer : numpy.ndarray : defaults to None.

    The trailer of an ADHOC file are the last 256 bytes of the file, and contain metadata.

  • file_name : string : defaults to None.

    Must correspond to an existing ADHOC file.

  • array : numpy.ndarray : defaults to None.

    Will be read from the file, and its size is the file size minus 256 bytes, and each field has 32 bytes and is encoded as a float.

Example usage:

import tuna
raw = tuna.io.adhoc ( file_name = "tuna/tuna/test/unit/unit_io/adhoc.ad3" )
raw.read ( )
raw.get_array ( )
raw.get_trailer ( )
get_array()[source]

This method’s goal is to return the current value of the data array.

Returns:

  • self.__array : numpy.ndarray

    Containing the current data array.

get_trailer()[source]

This method’s goal is to return the current trailer.

Returns:

  • self.__trailer : numpy.ndarray

    Containing the current values for the trailer.

read()[source]

This method’s goal is to discover the ADHOC type (which corresponds to the data array dimensionality), and when possible call the appropriate method to read its contents.