New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

tdm-loader

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tdm-loader - pypi Package Compare versions

Comparing version
1.2.4
to
1.2.5
+38
tdm_loader/tests/test_time_channel.py
"""Test """
import os
import pytest
import numpy as np
from numpy.testing import assert_array_equal
import tdm_loader as tdm
@pytest.fixture(scope="module")
def tdm_file(request):
"""Fixture for loading a test tdm file"""
filename = request.module.__file__
test_dir, _ = os.path.splitext(filename)
path = f"{test_dir}/test_file_time.tdm"
data = tdm.OpenFile(str(path))
return data
# pylint: disable=redefined-outer-name
def test_time_channel(tdm_file):
"""Test correct reading of the time channel"""
time_channel_ref = np.array([
'2022-11-04T14:37:48.565332889', '2022-11-04T14:37:49.285334110',
'2022-11-04T14:37:49.975335121', '2022-11-04T14:37:50.615335941',
'2022-11-04T14:37:51.255336761', '2022-11-04T14:37:51.905337810',
'2022-11-04T14:37:52.545338630', '2022-11-04T14:37:53.195339202',
'2022-11-04T14:37:53.835340499', '2022-11-04T14:37:54.485341072',
'2022-11-04T14:37:55.155342102', '2022-11-04T14:37:55.865343093',
'2022-11-04T14:37:56.525343894', '2022-11-04T14:37:57.235344886',
'2022-11-04T14:37:57.885345935', '2022-11-04T14:37:58.525346755',
'2022-11-04T14:37:59.165347576', '2022-11-04T14:37:59.905348777',
'2022-11-04T14:38:00.565349578', '2022-11-04T14:38:01.215350627',
'2022-11-04T14:38:01.865351676', '2022-11-04T14:38:02.555352687',
'2022-11-04T14:38:03.205353260', '2022-11-04T14:38:03.845354080',
'2022-11-04T14:38:04.485355377', '2022-11-04T14:38:05.125356197',
'2022-11-04T14:38:05.765357017'], dtype='datetime64[ns]')
assert_array_equal(tdm_file.channel(0, "Time"), time_channel_ref)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

+2
-1

@@ -54,2 +54,3 @@ # Temporary and binary files

.venv*/
.conda*/
.conda*/
.python-version
# Changelog
## Version 1.2.4
- Fixes the bug that the offset of implicit_linear sequences were not read correctly.
## Version 1.2.3
- Fixes packaging error.
Module couldn't be imported after install.
## Version 1.2.2
- Support for zip based tdm files
- Support for zip based tdm files
Metadata-Version: 2.1
Name: tdm_loader
Version: 1.2.4
Version: 1.2.5
Summary: Open National Instruments TDM/TDX files as NumPy structured arrays.

@@ -54,3 +54,1 @@ Home-page: https://github.com/domna/tdm_loader

data_file.channel_search(search_term)
Metadata-Version: 2.1
Name: tdm-loader
Version: 1.2.4
Version: 1.2.5
Summary: Open National Instruments TDM/TDX files as NumPy structured arrays.

@@ -54,3 +54,1 @@ Home-page: https://github.com/domna/tdm_loader

data_file.channel_search(search_term)

@@ -24,2 +24,3 @@ .gitignore

tdm_loader/tests/test_non_zip_tdm.py
tdm_loader/tests/test_time_channel.py
tdm_loader/tests/test_zip_tdm.py

@@ -29,2 +30,4 @@ tdm_loader/tests/test_non_zip_tdm/generate_test_file.vi

tdm_loader/tests/test_non_zip_tdm/test_sample0001.tdx
tdm_loader/tests/test_time_channel/test_file_time.tdm
tdm_loader/tests/test_time_channel/test_file_time.tdx
tdm_loader/tests/test_zip_tdm/2021-02-26_07-55-01.tdm

@@ -31,0 +34,0 @@ tdm_loader/tests/test_zip_tdm/2021-02-26_07-55-01.tdx

@@ -289,2 +289,9 @@ """This module allows National Instruments TDM/TDX files to be accessed like

valueType = ext_attribs["valueType"]
if valueType == "eTimeUsi":
endian = self._endian
dtype = np.dtype([("big", endian + "u8"), ("li", endian + "i8")])
else:
dtype = np.dtype(self._endian + DTYPE_CONVERTERS[valueType])
data_block = np.memmap(

@@ -294,3 +301,3 @@ self._tdx_path,

shape=(int(ext_attribs["length"]),),
dtype=np.dtype(self._endian + DTYPE_CONVERTERS[ext_attribs["valueType"]]),
dtype=dtype,
mode="r",

@@ -320,3 +327,9 @@ order=self._tdx_order,

if seqrep == "explicit":
column = np.array(data_block, float)
if valueType == "eTimeUsi":
epoch_difference_seconds = -2082844800
s = (data_block.field(1) + epoch_difference_seconds).astype("datetime64[s]")
ns = (data_block.field(0) * 2**(-64) * 1e18).astype("timedelta64[as]").astype("timedelta64[ns]")
column = s + ns
else:
column = np.array(data_block, float)
if nnans:

@@ -323,0 +336,0 @@ column[np.where(flags_block == 0)] = np.nan