Skip to content

Commit fff0fc8

Browse files
committed
Bug fix of getValuesWithUnit(..) + new version number and release notes
1 parent bc6f934 commit fff0fc8

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SignalTables"
22
uuid = "3201582d-3078-4276-ba5d-0a1254d79d7c"
33
authors = ["Martin.Otter@dlr.de <Martin.Otter@dlr.de>"]
4-
version = "0.3.2"
4+
version = "0.3.3"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

docs/src/index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,12 @@ are different to the Python 2.x version.
187187

188188
## Release Notes
189189

190-
### version 0.3.2
190+
### Version 0.3.3
191+
192+
- Bug fix: getValuesWithUnit(..) is now correctly returning the values vector, if no unit is defined.
193+
194+
195+
### Version 0.3.2
191196

192197
- Add makie.jl to be used by Makie backends.
193198
- For backwards compatibilty to ModiaResult, also accept ENV["MODIA_PLOT_PACKAGE"] instead of ENV["SignalTablesPlotPackage"]

src/SignalTableFunctions.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ getValuesWithUnit(signalTable, name::String) = begin
7777
elseif sigUnit != ""
7878
sigVal = sigVal*uparse(sigUnit)
7979
end
80+
return sigVal
8081
end
8182

8283

@@ -355,15 +356,16 @@ end
355356

356357

357358
"""
358-
flattenedSignal = getFlattenedSignal(signalTable, name;
359-
missingToNaN = true,
360-
targetInt = Int,
361-
targetFloat = Float64)
359+
signal = getFlattenedSignal(signalTable, name;
360+
missingToNaN = true,
361+
targetInt = Int,
362+
targetFloat = Float64)
362363
363-
Returns a copy of a signal where the values or the value are *flattened* and converted (e.g.: missing -> NaN).
364+
Returns a copy of a signal where the *flattened* and *converted* values (e.g.: missing -> NaN)
365+
are stored as `signal[:flattenedValues]` and the legend as `signal[:legend]`.
364366
A flattened signal can be, for example, used for traditional plot functions or for traditional tables.
365367
366-
Flattened values is a reshape of values into a vector or a matrix with optionally the following transformations:
368+
`signal[:flattenedValues]` is a reshape of values into a vector or a matrix with optionally the following transformations:
367369
368370
- `name` can be a signal name with or without array range indices (for example `name = "a.b.c[2,3:5]"`).
369371
- If `missingToNaN=true`, then missing values are replaced by NaN values.
@@ -372,15 +374,15 @@ Flattened values is a reshape of values into a vector or a matrix with optionall
372374
- If targetFloat is not nothing, Float-types are converted to targetFloat
373375
- collect(..) is performed on the result.
374376
375-
Legend is a vector of strings that provides a description for every array column
377+
`flattenedSignal[:legend]` is a vector of strings that provides a description for every array column
376378
(e.g. if `"name=a.b.c[2,3:5]", unit="m/s"`, then `legend = ["a.b.c[2,3] [m/s]", "a.b.c[2,3] [m/s]", "a.b.c[2,5] [m/s]"]`.
377379
378380
If the required transformation is not possible, a warning message is printed and `nothing` is returned.
379381
380382
As a special case, if signal[:values] is a vector or signal[:value] is a scalar and
381383
an element of values or value is of type `Measurements{targetFloat}` or
382-
`MonteCarloMeasurements{targetFloat}`, then the signal is not transformed and
383-
flattenedSignal = getValues(signalTable,name) or getValue(signalTable,name).
384+
`MonteCarloMeasurements{targetFloat}`, then the signal is not transformed,
385+
so signal[:flattenedValues] = signal[:values].
384386
"""
385387
function getFlattenedSignal(signalTable, name::String;
386388
missingToNaN = true,

0 commit comments

Comments
 (0)