diff --git a/Doxyfile b/Doxyfile index 72dbd13..d06c7aa 100644 --- a/Doxyfile +++ b/Doxyfile @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = /home/anne/wip/code/beamforming/doc +OUTPUT_DIRECTORY = doc # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -791,7 +791,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = /home/anne/wip/code/beamforming/beamforming +INPUT = lasp # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..e69de29 diff --git a/lasp/config.pxi.in b/lasp/config.pxi.in index 70d1e49..e46bf54 100644 --- a/lasp/config.pxi.in +++ b/lasp/config.pxi.in @@ -1,4 +1,3 @@ - import numpy as np cimport numpy as np from libcpp cimport bool @@ -29,6 +28,8 @@ cdef extern from "lasp_tracer.h": void fsTRACE(int) void feTRACE(int) void clearScreen() + + cdef extern from "lasp_mat.h": ctypedef struct dmat: us n_cols @@ -58,9 +59,10 @@ cdef extern from "lasp_mat.h": void cmat_free(cmat*) void cmat_copy(cmat* to,cmat* from_) + cdef extern from "numpy/arrayobject.h": void PyArray_ENABLEFLAGS(np.ndarray arr, int flags) + cdef extern from "lasp_python.h": object dmat_to_ndarray(dmat*,bint transfer_ownership) - diff --git a/lasp/lasp_measurement.py b/lasp/lasp_measurement.py index d5b620d..ec72d4a 100644 --- a/lasp/lasp_measurement.py +++ b/lasp/lasp_measurement.py @@ -205,18 +205,32 @@ class Measurement: @property def comment(self): + """ + Return the measurement comment + + Returns: + The measurement comment (text string) + """ return self._comment @comment.setter def comment(self, cmt): + """ + Set the measurement comment + + Args: + cmt: Comment text string to set + """ with self.file('r+') as f: + # Update comment attribute in the file f.attrs['comment'] = cmt self._comment = cmt @property def recTime(self): """ - Returns the total recording time of the measurement, in float seconds. + Returns + the total recording time of the measurement, in float seconds. """ return self.blocksize*self.nblocks/self.samplerate @@ -228,9 +242,15 @@ class Measurement: return self._time def scaleBlock(self, block): - # When the data is stored as integers, we assume dB full-scale scaling. - # Hence, when we convert the data to floats, we divide by the maximum - # possible value. + """ + When the data is stored as integers, we assume dB full-scale scaling. + Hence, when we convert the data to floats, we divide by the maximum + possible value. + + Returns: + Block of measurement data, scaled using sensitivity values and + retured as floating point values + """ return scaleBlockSens(block, self.sensitivity) @property @@ -259,8 +279,8 @@ class Measurement: def praw(self, block=None): """ - Returns the uncalibrated acoustic pressure signal, converted to floating - point acoustic pressure values [Pa]. + Returns the uncalibrated acoustic pressure signal, converted to + floating point acoustic pressure values [Pa]. """ if block is not None: with self.file() as f: diff --git a/lasp/lasp_octavefilter.py b/lasp/lasp_octavefilter.py index ff0a237..3a1c341 100644 --- a/lasp/lasp_octavefilter.py +++ b/lasp/lasp_octavefilter.py @@ -137,12 +137,21 @@ class FilterBank: class OctaveFilterBank(FilterBank, OctaveBankDesigner): + """ + Filter bank which uses FIR filtering for each octave frequency band + """ + def __init__(self, fs): OctaveBankDesigner.__init__(self) FilterBank.__init__(self, fs) class ThirdOctaveFilterBank(FilterBank, ThirdOctaveBankDesigner): + """ + Filter bank which uses FIR filtering for each one-third octave frequency + band. + """ + def __init__(self, fs): ThirdOctaveBankDesigner.__init__(self) FilterBank.__init__(self, fs) diff --git a/lasp/lasp_playback.py b/lasp/lasp_playback.py index a4b952f..f81605b 100644 --- a/lasp/lasp_playback.py +++ b/lasp/lasp_playback.py @@ -1,16 +1,12 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ -Created on Sat Mar 10 08:28:03 2018 -@author: Read data from image stream and record sound at the same time """ import cv2 as cv -import numpy as np import queue import sounddevice as sd import time -from matplotlib.pyplot import plot, show from .lasp_atomic import Atomic from threading import Thread, Condition import h5py @@ -57,22 +53,30 @@ class Playback: if verbose: print('Sample rate: ', self.samplerate) print('Number of audio frames: ', self.nblocks*self.blocksize) - print('Recording time: ', self.nblocks * - self.blocksize/self.samplerate) + print('Recording time: ', self.nblocks + * self.blocksize/self.samplerate) if video: try: f['video'] self._video_frame_positions = f['video_frame_positions'][:] - except: - print('No video available in measurement file. Disabling video') + except AttributeError: + print('No video available in measurement file.' + 'Disabling video') self._video = False @property def T(self): + """ + Returns + the lenght of the measurement in seconds + """ return self._nblocks*self._blocksize/self._samplerate def start(self): + """ + Start the playback + """ with h5py.File(self._fn, 'r') as f: self._ad = f['audio'] dtype = self._ad.dtype