diff --git a/lasp/c/lasp_pyarray.h b/lasp/c/lasp_pyarray.h index 54e0a22..b73c5f5 100644 --- a/lasp/c/lasp_pyarray.h +++ b/lasp/c/lasp_pyarray.h @@ -39,7 +39,15 @@ static inline PyObject *data_to_ndarray(void *data, int n_rows, int n_cols, assert(data); import_array(); - npy_intp dims[2] = {n_rows, n_cols}; + npy_intp dims[2]; + if(F_contiguous){ + dims[0] = n_cols; + dims[1] = n_rows; + + } else { + dims[0] = n_rows; + dims[1] = n_cols; + } assert(n_rows > 0); assert(n_cols > 0); @@ -50,7 +58,7 @@ static inline PyObject *data_to_ndarray(void *data, int n_rows, int n_cols, return NULL; } if (F_contiguous) { - PyArray_ENABLEFLAGS(arr, NPY_ARRAY_F_CONTIGUOUS); + arr = (PyArrayObject*) PyArray_Transpose(arr, NULL); } if (transfer_ownership == true) { diff --git a/lasp/lasp_common.py b/lasp/lasp_common.py index 37be552..3de2052 100644 --- a/lasp/lasp_common.py +++ b/lasp/lasp_common.py @@ -74,7 +74,7 @@ class SIQtys: level_ref_name=('1V',), level_ref_value=(1.0,), ) - types = (AP, V, N) + types = (N, AP, V) default = N default_index = 0 diff --git a/lasp/lasp_record.py b/lasp/lasp_record.py index 1878998..b896873 100644 --- a/lasp/lasp_record.py +++ b/lasp/lasp_record.py @@ -37,7 +37,7 @@ class Recording: if stream.avtype != AvType.audio_input: raise RuntimeError('Stream does not have any input channels') self.blocksize = stream.blocksize - self.samplerate = stream.samplerate + self.samplerate = stream.input_samplerate self._running = Atomic(False) self._running_cond = Condition() self.rectime = rectime @@ -77,11 +77,11 @@ class Recording: stream = self._stream f = self._f - nchannels = stream.nchannels + nchannels = len(stream.input_channel_names) self._ad = f.create_dataset('audio', (1, stream.blocksize, nchannels), - dtype=stream.numpy_dtype, + dtype=stream.input_numpy_dtype, maxshape=(None, stream.blocksize, nchannels), compression='gzip' @@ -96,11 +96,11 @@ class Recording: compression='gzip' ) - f.attrs['samplerate'] = stream.samplerate - f.attrs['nchannels'] = stream.nchannels + f.attrs['samplerate'] = stream.input_samplerate + f.attrs['nchannels'] = nchannels f.attrs['blocksize'] = stream.blocksize - f.attrs['sensitivity'] = stream.sensitivity - f.attrs['channel_names'] = stream.channel_names + f.attrs['sensitivity'] = stream.input_sensitivity + f.attrs['channel_names'] = stream.input_channel_names f.attrs['time'] = time.time() self._running <<= True