Skip to content

Commit c6ff066

Browse files
committed
Merge branch 'release/v0.3.4'
2 parents 5279443 + 2d7b0de commit c6ff066

File tree

11 files changed

+31
-20
lines changed

11 files changed

+31
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ nosetests.xml
4040
# data files
4141
*.h5
4242
*.mat
43+
!DoublePendulum.mat
4344

4445
# temp files
4546
~*

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# Changelog
22

3-
## [0.3.3] (2017-12-13)
3+
## v0.3.4 (2019-02-14)
4+
5+
Apply sign when reading time series from Dymola result files (.mat)
6+
7+
## v0.3.3 (2017-12-13)
48

59
### Changed
6-
- Distribution package changed from .tar.gz to .whl (Python Wheel)
710

8-
## [0.3.2] (2017-07-09)
11+
Distribution package changed from .tar.gz to .whl (Python Wheel)
12+
13+
## v0.3.2 (2017-07-09)
914

1015
### Added
11-
- Support for Linux and Mac
16+
17+
Add support for Linux and Mac

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Get the scale for the first dimension:
7272

7373
-----------------------------
7474

75-
|copyright| 2017 |Dassault Systemes|
75+
|copyright| 2019 |Dassault Systemes|
7676

7777
.. _SDF specification: https://github.com/ScientificDataFormat/SDF
7878
.. _HDF5: https://www.hdfgroup.org/hdf5/

sdf/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2017 Dassault Systemes. All rights reserved.
1+
# Copyright (c) 2019 Dassault Systemes. All rights reserved.
22

33
import numpy as np
44
from .units import convert_unit
@@ -7,7 +7,7 @@
77

88
from . import hdf5
99

10-
__version__ = '0.3.3'
10+
__version__ = '0.3.4'
1111

1212
_object_name_pattern = re.compile('[a-zA-Z][a-zA-Z0-9_]*')
1313

sdf/dsres.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2017 Dassault Systemes. All rights reserved.
1+
# Copyright (c) 2019 Dassault Systemes. All rights reserved.
22

33
import numpy as np
44
from sdf import Group, Dataset
@@ -130,9 +130,9 @@ def _load_mat(filename):
130130
pass
131131

132132
if d == 1:
133-
data = cons[c, 0]
133+
data = cons[c, 0] * s
134134
else:
135-
data = traj[c, :]
135+
data = traj[c, :] * s
136136

137137
if 'type' in info:
138138
if info['type'] == 'Integer' or 'Boolean':

sdf/hdf5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2017 Dassault Systemes. All rights reserved.
1+
# Copyright (c) 2019 Dassault Systemes. All rights reserved.
22

33
import h5py
44
import sdf

sdf/ndtable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2017 Dassault Systemes. All rights reserved.
1+
# Copyright (c) 2019 Dassault Systemes. All rights reserved.
22

33
from ctypes import c_double, c_void_p, c_int, byref, cdll
44
import numpy as np

sdf/units.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2017 Dassault Systemes. All rights reserved.
1+
# Copyright (c) 2019 Dassault Systemes. All rights reserved.
22

33
import math
44

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def readme():
1111

1212

1313
setup(name='SDF',
14-
version='0.3.3',
14+
version='0.3.4',
1515
description="Work with Scientific Data Format files in Python",
1616
long_description=readme(),
1717
url="https://github.com/ScientificDataFormat/SDF-Python",

tests/DoublePendulum.mat

339 KB
Binary file not shown.

tests/test_sdf.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,12 @@ def test_dsres_load_all(self):
247247

248248
s = g['Time']
249249
self.assertEqual(s.data.size, 552)
250-
self.assertEqual(s.data.dtype, np.float32)
250+
self.assertEqual(s.data.dtype, np.dtype(np.float32))
251251
self.assertEqual(s.unit, 's')
252252
self.assertEqual(s.comment, 'Simulation time')
253253

254254
ds = g['booleanPulse2']['period']
255255
self.assertEqual(ds.data, 2.0)
256-
self.assertEqual(ds.data.dtype, np.float32)
257256
self.assertEqual(ds.unit, 's')
258257
self.assertEqual(ds.comment, 'Time for one period')
259258

@@ -278,26 +277,31 @@ def test_dsres_load_dataset(self):
278277
ds = sdf.load(filename, objectname='/booleanPulse2/period')
279278

280279
self.assertEqual(ds.data, 2.0)
281-
self.assertEqual(ds.data.dtype, np.float32)
282280
self.assertEqual(ds.unit, 's')
283281
self.assertEqual(ds.comment, 'Time for one period')
284282

285283
ds = sdf.load(filename, objectname='/booleanPulse2/y')
286-
self.assertEqual(ds.data.dtype, np.int32)
284+
self.assertEqual(ds.data.dtype, np.dtype(np.int32))
287285
self.assertEqual(ds.data.size, 552)
288286
self.assertEqual(ds.data[0], True)
289287
self.assertEqual(ds.data[93], False)
290288

291289
s = ds.scales[0]
292290
self.assertEqual(s.data.size, 552)
293-
self.assertEqual(s.data.dtype, np.float32)
291+
self.assertEqual(s.data.dtype, np.dtype(np.float32))
294292
self.assertEqual(s.unit, 's')
295293
self.assertEqual(s.comment, 'Simulation time')
296294

297295
ds = sdf.load(filename, objectname='/integerConstant/k')
298-
self.assertEqual(ds.data.dtype, np.int32)
296+
self.assertEqual(ds.data.dtype, np.dtype(np.int32))
299297
self.assertEqual(ds.data, 1)
300298

299+
def test_dsres_inverted_signals(self):
300+
path = os.path.dirname(__file__)
301+
filename = os.path.join(path, 'DoublePendulum.mat')
302+
rvisobj = sdf.load(filename, '/world/y_label/cylinders[2]/rvisobj[1]')
303+
self.assertTrue(rvisobj.data < 0)
304+
301305
@skipIf(platform.system() != 'Windows', "Test requires display")
302306
def test_interp_1d_example(self):
303307
runpy.run_module('sdf.examples.interp_1d')

0 commit comments

Comments
 (0)