tsam 2.3.3__tar.gz → 2.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. {tsam-2.3.3 → tsam-2.3.4}/.github/workflows/daily_tests.yml +8 -3
  2. {tsam-2.3.3 → tsam-2.3.4}/PKG-INFO +1 -1
  3. {tsam-2.3.3 → tsam-2.3.4}/setup.py +1 -1
  4. {tsam-2.3.3 → tsam-2.3.4}/test/test_durationRepresentation.py +9 -4
  5. {tsam-2.3.3 → tsam-2.3.4}/test/test_samemean.py +30 -0
  6. {tsam-2.3.3 → tsam-2.3.4}/tsam/timeseriesaggregation.py +26 -13
  7. {tsam-2.3.3 → tsam-2.3.4}/tsam.egg-info/PKG-INFO +1 -1
  8. {tsam-2.3.3 → tsam-2.3.4}/.github/workflows/test_on_push_and_pull.yml +0 -0
  9. {tsam-2.3.3 → tsam-2.3.4}/.gitignore +0 -0
  10. {tsam-2.3.3 → tsam-2.3.4}/.gitlab-ci.yml +0 -0
  11. {tsam-2.3.3 → tsam-2.3.4}/.readthedocs.yml +0 -0
  12. {tsam-2.3.3 → tsam-2.3.4}/LICENSE.txt +0 -0
  13. {tsam-2.3.3 → tsam-2.3.4}/MANIFEST.in +0 -0
  14. {tsam-2.3.3 → tsam-2.3.4}/Makefile +0 -0
  15. {tsam-2.3.3 → tsam-2.3.4}/README.md +0 -0
  16. {tsam-2.3.3 → tsam-2.3.4}/docs/Makefile +0 -0
  17. {tsam-2.3.3 → tsam-2.3.4}/docs/make.bat +0 -0
  18. {tsam-2.3.3 → tsam-2.3.4}/docs/source/_static/logo.png +0 -0
  19. {tsam-2.3.3 → tsam-2.3.4}/docs/source/_static/tsam-logo.png +0 -0
  20. {tsam-2.3.3 → tsam-2.3.4}/docs/source/conf.py +0 -0
  21. {tsam-2.3.3 → tsam-2.3.4}/docs/source/durationRepresentationDoc.rst +0 -0
  22. {tsam-2.3.3 → tsam-2.3.4}/docs/source/exactKmedoidsDoc.rst +0 -0
  23. {tsam-2.3.3 → tsam-2.3.4}/docs/source/furtherReadingDoc.rst +0 -0
  24. {tsam-2.3.3 → tsam-2.3.4}/docs/source/gettingStartedDoc.rst +0 -0
  25. {tsam-2.3.3 → tsam-2.3.4}/docs/source/hypertunedaggregationDoc.rst +0 -0
  26. {tsam-2.3.3 → tsam-2.3.4}/docs/source/index.rst +0 -0
  27. {tsam-2.3.3 → tsam-2.3.4}/docs/source/installationDoc.rst +0 -0
  28. {tsam-2.3.3 → tsam-2.3.4}/docs/source/integratedSoftwareDoc.rst +0 -0
  29. {tsam-2.3.3 → tsam-2.3.4}/docs/source/kmaxoidsDoc.rst +0 -0
  30. {tsam-2.3.3 → tsam-2.3.4}/docs/source/legalNoticeDoc.rst +0 -0
  31. {tsam-2.3.3 → tsam-2.3.4}/docs/source/mathematicalBackgroundDoc.rst +0 -0
  32. {tsam-2.3.3 → tsam-2.3.4}/docs/source/newsDoc.rst +0 -0
  33. {tsam-2.3.3 → tsam-2.3.4}/docs/source/periodAggregationDoc.rst +0 -0
  34. {tsam-2.3.3 → tsam-2.3.4}/docs/source/representationsDoc.rst +0 -0
  35. {tsam-2.3.3 → tsam-2.3.4}/docs/source/segmentationDoc.rst +0 -0
  36. {tsam-2.3.3 → tsam-2.3.4}/docs/source/structureOfTsamDoc.rst +0 -0
  37. {tsam-2.3.3 → tsam-2.3.4}/docs/source/timeseriesaggregationDoc.rst +0 -0
  38. {tsam-2.3.3 → tsam-2.3.4}/examples/aggregation_example.ipynb +0 -0
  39. {tsam-2.3.3 → tsam-2.3.4}/examples/aggregation_method_showcase.ipynb +0 -0
  40. {tsam-2.3.3 → tsam-2.3.4}/examples/aggregation_optiinput.ipynb +0 -0
  41. {tsam-2.3.3 → tsam-2.3.4}/examples/aggregation_representation.ipynb +0 -0
  42. {tsam-2.3.3 → tsam-2.3.4}/examples/aggregation_segment_period_animation.ipynb +0 -0
  43. {tsam-2.3.3 → tsam-2.3.4}/examples/aggregation_segment_period_building_timeseries.ipynb +0 -0
  44. {tsam-2.3.3 → tsam-2.3.4}/examples/aggregation_segment_period_opti.ipynb +0 -0
  45. {tsam-2.3.3 → tsam-2.3.4}/examples/aggregation_segmentation.ipynb +0 -0
  46. {tsam-2.3.3 → tsam-2.3.4}/examples/example_k_maxoids.ipynb +0 -0
  47. {tsam-2.3.3 → tsam-2.3.4}/examples/get_clustercenter_indices.py +0 -0
  48. {tsam-2.3.3 → tsam-2.3.4}/examples/predefined_sequence_example.ipynb +0 -0
  49. {tsam-2.3.3 → tsam-2.3.4}/examples/results/paretoOptimalAggregation.csv +0 -0
  50. {tsam-2.3.3 → tsam-2.3.4}/examples/results/preprocessed_wind.csv +0 -0
  51. {tsam-2.3.3 → tsam-2.3.4}/examples/results/testperiods_hierarchical.csv +0 -0
  52. {tsam-2.3.3 → tsam-2.3.4}/examples/results/testperiods_kmeans.csv +0 -0
  53. {tsam-2.3.3 → tsam-2.3.4}/examples/results/testperiods_kmedoids.csv +0 -0
  54. {tsam-2.3.3 → tsam-2.3.4}/examples/results/testperiods_predefClusterOrder.csv +0 -0
  55. {tsam-2.3.3 → tsam-2.3.4}/examples/results/testperiods_predefClusterOrderAndClusterCenters.csv +0 -0
  56. {tsam-2.3.3 → tsam-2.3.4}/examples/results/testperiods_segmentation.csv +0 -0
  57. {tsam-2.3.3 → tsam-2.3.4}/examples/testdata.csv +0 -0
  58. {tsam-2.3.3 → tsam-2.3.4}/requirements.txt +0 -0
  59. {tsam-2.3.3 → tsam-2.3.4}/requirements.yml +0 -0
  60. {tsam-2.3.3 → tsam-2.3.4}/requirements_dev.txt +0 -0
  61. {tsam-2.3.3 → tsam-2.3.4}/requirements_dev.yml +0 -0
  62. {tsam-2.3.3 → tsam-2.3.4}/setup.cfg +0 -0
  63. {tsam-2.3.3 → tsam-2.3.4}/test/test_accuracyIndicators.py +0 -0
  64. {tsam-2.3.3 → tsam-2.3.4}/test/test_adjacent_periods.py +0 -0
  65. {tsam-2.3.3 → tsam-2.3.4}/test/test_aggregate_hiearchical.py +0 -0
  66. {tsam-2.3.3 → tsam-2.3.4}/test/test_assert_raises.py +0 -0
  67. {tsam-2.3.3 → tsam-2.3.4}/test/test_averaging.py +0 -0
  68. {tsam-2.3.3 → tsam-2.3.4}/test/test_cluster_order.py +0 -0
  69. {tsam-2.3.3 → tsam-2.3.4}/test/test_durationCurve.py +0 -0
  70. {tsam-2.3.3 → tsam-2.3.4}/test/test_extremePeriods.py +0 -0
  71. {tsam-2.3.3 → tsam-2.3.4}/test/test_hierarchical.py +0 -0
  72. {tsam-2.3.3 → tsam-2.3.4}/test/test_hypertuneAggregation.py +0 -0
  73. {tsam-2.3.3 → tsam-2.3.4}/test/test_k_maxoids.py +0 -0
  74. {tsam-2.3.3 → tsam-2.3.4}/test/test_k_medoids.py +0 -0
  75. {tsam-2.3.3 → tsam-2.3.4}/test/test_k_medoids_contiguity.py +0 -0
  76. {tsam-2.3.3 → tsam-2.3.4}/test/test_minmaxRepresentation.py +0 -0
  77. {tsam-2.3.3 → tsam-2.3.4}/test/test_preprocess.py +0 -0
  78. {tsam-2.3.3 → tsam-2.3.4}/test/test_properties.py +0 -0
  79. {tsam-2.3.3 → tsam-2.3.4}/test/test_segmentation.py +0 -0
  80. {tsam-2.3.3 → tsam-2.3.4}/test/test_subhourlyResolution.py +0 -0
  81. {tsam-2.3.3 → tsam-2.3.4}/test/test_subhourly_periods.py +0 -0
  82. {tsam-2.3.3 → tsam-2.3.4}/test/test_weightingFactors.py +0 -0
  83. {tsam-2.3.3 → tsam-2.3.4}/tsam/__init__.py +0 -0
  84. {tsam-2.3.3 → tsam-2.3.4}/tsam/hyperparametertuning.py +0 -0
  85. {tsam-2.3.3 → tsam-2.3.4}/tsam/periodAggregation.py +0 -0
  86. {tsam-2.3.3 → tsam-2.3.4}/tsam/representations.py +0 -0
  87. {tsam-2.3.3 → tsam-2.3.4}/tsam/utils/__init__.py +0 -0
  88. {tsam-2.3.3 → tsam-2.3.4}/tsam/utils/durationRepresentation.py +0 -0
  89. {tsam-2.3.3 → tsam-2.3.4}/tsam/utils/k_maxoids.py +0 -0
  90. {tsam-2.3.3 → tsam-2.3.4}/tsam/utils/k_medoids_contiguity.py +0 -0
  91. {tsam-2.3.3 → tsam-2.3.4}/tsam/utils/k_medoids_exact.py +0 -0
  92. {tsam-2.3.3 → tsam-2.3.4}/tsam/utils/segmentation.py +0 -0
  93. {tsam-2.3.3 → tsam-2.3.4}/tsam.egg-info/SOURCES.txt +0 -0
  94. {tsam-2.3.3 → tsam-2.3.4}/tsam.egg-info/dependency_links.txt +0 -0
  95. {tsam-2.3.3 → tsam-2.3.4}/tsam.egg-info/requires.txt +0 -0
  96. {tsam-2.3.3 → tsam-2.3.4}/tsam.egg-info/top_level.txt +0 -0
@@ -1,6 +1,11 @@
1
1
  # This tests are run daily to check incompatibilties introduced by new versions of dependencies
2
2
  name: Daily tsam tests
3
- on:
3
+ on:
4
+ # Enables manual start
5
+ workflow_dispatch:
6
+ inputs:
7
+ tags:
8
+ description: 'Manual run'
4
9
  schedule:
5
10
  # * is a special character in YAML so you have to quote this string
6
11
  # Some Examples for cron syntax https://crontab.guru/examples.html
@@ -10,8 +15,8 @@ on:
10
15
  # - cron: 0 0 * * 0
11
16
 
12
17
  jobs:
13
- PythonAndOsTest:
14
- name: Test for Python ${{matrix.python-version}} on ${{matrix.os}}
18
+ DailyPythonAndOsTest:
19
+ name: Daily tests for Python ${{matrix.python-version}} on ${{matrix.os}}
15
20
  runs-on: ${{matrix.os}}
16
21
  strategy:
17
22
  fail-fast: false
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tsam
3
- Version: 2.3.3
3
+ Version: 2.3.4
4
4
  Summary: Time series aggregation module (tsam) to create typical periods
5
5
  Home-page: https://github.com/FZJ-IEK3-VSA/tsam
6
6
  Author: Leander Kotzur, Maximilian Hoffmann
@@ -8,7 +8,7 @@ with open(os.path.join(dir_path, "README.md"), "r") as fh:
8
8
 
9
9
  setuptools.setup(
10
10
  name="tsam",
11
- version="2.3.3",
11
+ version="2.3.4",
12
12
  author="Leander Kotzur, Maximilian Hoffmann",
13
13
  author_email="leander.kotzur@googlemail.com, maximilian.hoffmann@julumni.fz-juelich.de",
14
14
  description="Time series aggregation module (tsam) to create typical periods",
@@ -88,15 +88,15 @@ def test_distributionMinMaxRepresentation():
88
88
 
89
89
  aggregation = tsam.TimeSeriesAggregation(
90
90
  raw,
91
- noTypicalPeriods=24,
91
+ noTypicalPeriods=8,
92
92
  segmentation=True,
93
- noSegments=8,
93
+ noSegments=4,
94
94
  hoursPerPeriod=24,
95
95
  sortValues=False,
96
96
  clusterMethod="hierarchical",
97
97
  representationMethod="distributionAndMinMaxRepresentation",
98
98
  distributionPeriodWise=False,
99
- rescaleClusterPeriods=False,
99
+ rescaleClusterPeriods=True,
100
100
  )
101
101
 
102
102
  predictedPeriods = aggregation.predictOriginalData()
@@ -112,10 +112,15 @@ def test_distributionMinMaxRepresentation():
112
112
  predictedPeriods.min(),
113
113
  )
114
114
 
115
+ np.testing.assert_array_equal(
116
+ raw.mean(),
117
+ predictedPeriods.mean()
118
+ )
119
+
115
120
  assert np.isclose(
116
121
  raw.mean(),
117
122
  predictedPeriods.mean(),
118
- atol=1e-4
123
+ atol=1e-10
119
124
  ).all()
120
125
 
121
126
 
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import time
3
+ import json
3
4
 
4
5
  import pandas as pd
5
6
  import numpy as np
@@ -44,6 +45,35 @@ def test_samemean():
44
45
 
45
46
 
46
47
 
48
+ def test_durationRepresentation():
49
+
50
+ raw = json.load(
51
+ open(os.path.join(os.path.dirname(__file__), "..", "examples", "testdata_2.json"))
52
+ )
53
+
54
+ starttime = time.time()
55
+
56
+
57
+ aggregation = tsam.TimeSeriesAggregation(
58
+ raw,
59
+ noTypicalPeriods=3,
60
+ noSegments=8,
61
+ hoursPerPeriod=24,
62
+ sortValues=False,
63
+ clusterMethod="hierarchical",
64
+ segmentation=True,
65
+ representationMethod="durationRepresentation",
66
+ distributionPeriodWise=False,
67
+ rescaleClusterPeriods=False,
68
+ resolution=1,
69
+ )
70
+
71
+ periods = aggregation.createTypicalPeriods()
72
+
73
+ print("Clustering took " + str(time.time() - starttime))
74
+
75
+ # make sure that the sum of the attribute specific RMSEs is smaller for the k-means clustering with centroid
76
+ assert True
47
77
 
48
78
 
49
79
 
@@ -136,6 +136,7 @@ class TimeSeriesAggregation(object):
136
136
  predefClusterOrder=None,
137
137
  predefClusterCenterIndices=None,
138
138
  solver="highs",
139
+ numericalTolerance=1e-13,
139
140
  roundOutput=None,
140
141
  addPeakMin=None,
141
142
  addPeakMax=None,
@@ -254,6 +255,10 @@ class TimeSeriesAggregation(object):
254
255
  :param solver: Solver that is used for k_medoids clustering. optional (default: 'cbc' )
255
256
  :type solver: string
256
257
 
258
+ :param numericalTolerance: Tolerance for numerical issues. Silences the warning for exceeding upper or lower bounds
259
+ of the time series. optional (default: 1e-13 )
260
+ :type numericalTolerance: float
261
+
257
262
  :param roundOutput: Decimals to what the output time series get round. optional (default: None )
258
263
  :type roundOutput: integer
259
264
 
@@ -321,6 +326,8 @@ class TimeSeriesAggregation(object):
321
326
 
322
327
  self.solver = solver
323
328
 
329
+ self.numericalTolerance = numericalTolerance
330
+
324
331
  self.segmentation = segmentation
325
332
 
326
333
  self.roundOutput = roundOutput
@@ -1097,23 +1104,29 @@ class TimeSeriesAggregation(object):
1097
1104
  if np.array(
1098
1105
  self.typicalPeriods.max(axis=0) > self.timeSeries.max(axis=0)
1099
1106
  ).any():
1100
- warning_list = self.typicalPeriods.max(axis=0) < self.timeSeries.max(axis=0)
1101
- warnings.warn(
1102
- "Something went wrong... At least one maximal value of the " +
1103
- "aggregated time series exceeds the maximal value " +
1104
- "the input time series for: " +
1105
- "{}".format(list(warning_list[warning_list>0].index))
1106
- )
1107
+ warning_list = self.typicalPeriods.max(axis=0) > self.timeSeries.max(axis=0)
1108
+ diff = self.typicalPeriods.max(axis=0) - self.timeSeries.max(axis=0)
1109
+ if abs(diff).max() > self.numericalTolerance:
1110
+ warnings.warn(
1111
+ "At least one maximal value of the " +
1112
+ "aggregated time series exceeds the maximal value " +
1113
+ "the input time series for: " +
1114
+ "{}".format(diff[warning_list[warning_list>0].index].to_dict()) +
1115
+ ". To silence the warning set the 'numericalTolerance' to a higher value."
1116
+ )
1107
1117
  if np.array(
1108
1118
  self.typicalPeriods.min(axis=0) < self.timeSeries.min(axis=0)
1109
1119
  ).any():
1110
1120
  warning_list = self.typicalPeriods.min(axis=0) < self.timeSeries.min(axis=0)
1111
- warnings.warn(
1112
- "Something went wrong... At least one minimal value of the " +
1113
- "aggregated time series exceeds the minimal value " +
1114
- "the input time series for: " +
1115
- "{}".format(list(warning_list[warning_list>0].index))
1116
- )
1121
+ diff = self.typicalPeriods.min(axis=0) - self.timeSeries.min(axis=0)
1122
+ if abs(diff).max() > self.numericalTolerance:
1123
+ warnings.warn(
1124
+ "Something went wrong... At least one minimal value of the " +
1125
+ "aggregated time series exceeds the minimal value " +
1126
+ "the input time series for: " +
1127
+ "{}".format(diff[warning_list[warning_list>0].index].to_dict()) +
1128
+ ". To silence the warning set the 'numericalTolerance' to a higher value."
1129
+ )
1117
1130
  return self.typicalPeriods
1118
1131
 
1119
1132
  def prepareEnersysInput(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tsam
3
- Version: 2.3.3
3
+ Version: 2.3.4
4
4
  Summary: Time series aggregation module (tsam) to create typical periods
5
5
  Home-page: https://github.com/FZJ-IEK3-VSA/tsam
6
6
  Author: Leander Kotzur, Maximilian Hoffmann
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes