Some markup improvements and comments.

This commit is contained in:
Anne de Jong 2019-01-05 12:13:05 +01:00
parent 1bd5d9b016
commit f7b596fee8
6 changed files with 53 additions and 18 deletions

View File

@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If # entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used. # 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- # 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 # 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 # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # 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 # 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 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

0
MANIFEST.in Normal file
View File

View File

@ -1,4 +1,3 @@
import numpy as np import numpy as np
cimport numpy as np cimport numpy as np
from libcpp cimport bool from libcpp cimport bool
@ -29,6 +28,8 @@ cdef extern from "lasp_tracer.h":
void fsTRACE(int) void fsTRACE(int)
void feTRACE(int) void feTRACE(int)
void clearScreen() void clearScreen()
cdef extern from "lasp_mat.h": cdef extern from "lasp_mat.h":
ctypedef struct dmat: ctypedef struct dmat:
us n_cols us n_cols
@ -58,9 +59,10 @@ cdef extern from "lasp_mat.h":
void cmat_free(cmat*) void cmat_free(cmat*)
void cmat_copy(cmat* to,cmat* from_) void cmat_copy(cmat* to,cmat* from_)
cdef extern from "numpy/arrayobject.h": cdef extern from "numpy/arrayobject.h":
void PyArray_ENABLEFLAGS(np.ndarray arr, int flags) void PyArray_ENABLEFLAGS(np.ndarray arr, int flags)
cdef extern from "lasp_python.h": cdef extern from "lasp_python.h":
object dmat_to_ndarray(dmat*,bint transfer_ownership) object dmat_to_ndarray(dmat*,bint transfer_ownership)

View File

@ -205,18 +205,32 @@ class Measurement:
@property @property
def comment(self): def comment(self):
"""
Return the measurement comment
Returns:
The measurement comment (text string)
"""
return self._comment return self._comment
@comment.setter @comment.setter
def comment(self, cmt): def comment(self, cmt):
"""
Set the measurement comment
Args:
cmt: Comment text string to set
"""
with self.file('r+') as f: with self.file('r+') as f:
# Update comment attribute in the file
f.attrs['comment'] = cmt f.attrs['comment'] = cmt
self._comment = cmt self._comment = cmt
@property @property
def recTime(self): 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 return self.blocksize*self.nblocks/self.samplerate
@ -228,9 +242,15 @@ class Measurement:
return self._time return self._time
def scaleBlock(self, block): 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 When the data is stored as integers, we assume dB full-scale scaling.
# possible value. 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) return scaleBlockSens(block, self.sensitivity)
@property @property
@ -259,8 +279,8 @@ class Measurement:
def praw(self, block=None): def praw(self, block=None):
""" """
Returns the uncalibrated acoustic pressure signal, converted to floating Returns the uncalibrated acoustic pressure signal, converted to
point acoustic pressure values [Pa]. floating point acoustic pressure values [Pa].
""" """
if block is not None: if block is not None:
with self.file() as f: with self.file() as f:

View File

@ -137,12 +137,21 @@ class FilterBank:
class OctaveFilterBank(FilterBank, OctaveBankDesigner): class OctaveFilterBank(FilterBank, OctaveBankDesigner):
"""
Filter bank which uses FIR filtering for each octave frequency band
"""
def __init__(self, fs): def __init__(self, fs):
OctaveBankDesigner.__init__(self) OctaveBankDesigner.__init__(self)
FilterBank.__init__(self, fs) FilterBank.__init__(self, fs)
class ThirdOctaveFilterBank(FilterBank, ThirdOctaveBankDesigner): class ThirdOctaveFilterBank(FilterBank, ThirdOctaveBankDesigner):
"""
Filter bank which uses FIR filtering for each one-third octave frequency
band.
"""
def __init__(self, fs): def __init__(self, fs):
ThirdOctaveBankDesigner.__init__(self) ThirdOctaveBankDesigner.__init__(self)
FilterBank.__init__(self, fs) FilterBank.__init__(self, fs)

View File

@ -1,16 +1,12 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- 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 cv2 as cv
import numpy as np
import queue import queue
import sounddevice as sd import sounddevice as sd
import time import time
from matplotlib.pyplot import plot, show
from .lasp_atomic import Atomic from .lasp_atomic import Atomic
from threading import Thread, Condition from threading import Thread, Condition
import h5py import h5py
@ -57,22 +53,30 @@ class Playback:
if verbose: if verbose:
print('Sample rate: ', self.samplerate) print('Sample rate: ', self.samplerate)
print('Number of audio frames: ', self.nblocks*self.blocksize) print('Number of audio frames: ', self.nblocks*self.blocksize)
print('Recording time: ', self.nblocks * print('Recording time: ', self.nblocks
self.blocksize/self.samplerate) * self.blocksize/self.samplerate)
if video: if video:
try: try:
f['video'] f['video']
self._video_frame_positions = f['video_frame_positions'][:] self._video_frame_positions = f['video_frame_positions'][:]
except: except AttributeError:
print('No video available in measurement file. Disabling video') print('No video available in measurement file.'
'Disabling video')
self._video = False self._video = False
@property @property
def T(self): def T(self):
"""
Returns
the lenght of the measurement in seconds
"""
return self._nblocks*self._blocksize/self._samplerate return self._nblocks*self._blocksize/self._samplerate
def start(self): def start(self):
"""
Start the playback
"""
with h5py.File(self._fn, 'r') as f: with h5py.File(self._fn, 'r') as f:
self._ad = f['audio'] self._ad = f['audio']
dtype = self._ad.dtype dtype = self._ad.dtype