PySimultan 0.6.1__tar.gz → 0.6.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.
- {pysimultan-0.6.1 → pysimultan-0.6.4}/.gitignore +1 -0
- pysimultan-0.6.4/LICENSE.txt +29 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/PKG-INFO +4 -1
- {pysimultan-0.6.1 → pysimultan-0.6.4}/README.md +3 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/CHANGELOG.md +7 -0
- pysimultan-0.6.4/src/PySimultan2/__about__.py +1 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/data_model.py +1 -1
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/default_types.py +8 -3
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/files.py +39 -5
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/multi_values.py +59 -2
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/SIMULTAN.Lang.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/SIMULTAN.Lang.xml +398 -21
- pysimultan-0.6.4/src/PySimultan2/resources/SIMULTAN.Plugins.dll +0 -0
- pysimultan-0.6.4/src/PySimultan2/resources/SIMULTAN.Plugins.xml +367 -0
- pysimultan-0.6.4/src/PySimultan2/resources/SIMULTAN.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/SIMULTAN.xml +521 -86
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/utils.py +3 -2
- pysimultan-0.6.4/tests/resources/new_test_file.txt +1 -0
- pysimultan-0.6.4/tests/resources/new_test_file2.txt +1 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_files.py +1 -2
- pysimultan-0.6.4/tests/test_numpy.py +108 -0
- pysimultan-0.6.1/LICENSE.txt +0 -9
- pysimultan-0.6.1/src/PySimultan2/__about__.py +0 -1
- pysimultan-0.6.1/src/PySimultan2/resources/AssimpNet.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/AvalonDock.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/BruTile.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/ComponentBuilder.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/ComponentBuilder.dll.config +0 -56
- pysimultan-0.6.1/src/PySimultan2/resources/ComponentBuilder.runtimeconfig.json +0 -19
- pysimultan-0.6.1/src/PySimultan2/resources/ComponentBuilder.xml +0 -19291
- pysimultan-0.6.1/src/PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/HelixToolkit.Core.Wpf.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/HelixToolkit.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/Python.Runtime.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/SIMULTAN.UI.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/SIMULTAN.UI.xml +0 -16079
- pysimultan-0.6.1/src/PySimultan2/resources/SIMULTAN.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/SharpDX.D3DCompiler.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/SharpDX.DXGI.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/SharpDX.Direct2D1.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/SharpDX.Direct3D11.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/SharpDX.Direct3D9.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/SharpDX.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/System.Collections.Immutable.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/System.Reflection.Metadata.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/XAMLMarkupExtensions.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/assimp.dll +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/componentmanager.user +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/defaultsettings.xml +0 -0
- pysimultan-0.6.1/src/PySimultan2/resources/setup.bat +0 -1
- pysimultan-0.6.1/tests/resources/new_test_file.txt +0 -1
- pysimultan-0.6.1/tests/resources/new_test_file2.txt +0 -1
- {pysimultan-0.6.1 → pysimultan-0.6.4}/pyproject.toml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/geometry/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/geometry/geometry_base.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/geometry/utils.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/object_mapper.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/ClosedXML.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/ControlzEx.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/DocumentFormat.OpenXml.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/DotSpatial.Projections.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/ExcelNumberFormat.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Fluent.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/MathNet.Numerics.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.AspNetCore.Authorization.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.Extensions.Options.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.Extensions.Primitives.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.Shell.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Microsoft.Xaml.Behaviors.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Newtonsoft.Json.Bson.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Newtonsoft.Json.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/SharpDX.Mathematics.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Sprache.Calc.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/Sprache.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/System.Data.OleDb.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/System.Net.Http.Formatting.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/System.Reflection.MetadataLoadContext.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/resources/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/simultan_object.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/taxonomy_maps.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/src/PySimultan2/type_setter_lookup.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/RoomAcoustics_V02.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/create_component.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/create_component_with_taxonomy_slot.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/create_referenced_component.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/create_taxonomies.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/empty_test_excel.xlsx +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/template_example3.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/template_example4.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/template_example_create_typed_component.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/template_example_create_typed_component_with_slots.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/template_example_extend.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/template_example_update_references.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/readme_examples/resources/template_reference_list.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/resources/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_calc_static_zone_temperature.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_calculate_steady_state_temperature.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_circular_references.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_create_geometry.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_default_component.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_directory_and_files.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_files_load.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_load_geometry.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_load_multi_values.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_new_dll.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_new_project_creation.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_numeric_map.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_parameter_reference.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_pythonnet.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_register_class.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_register_decorator.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_set_attr_property.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_set_dictionary.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_set_properties.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_taxonomie_maps.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_taxonomies.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/test_ui.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.4}/tests/ui_minimal_example.py +0 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
Academic GPL License Agreement
|
2
|
+
|
3
|
+
1. PreambleThis software is released under the terms of the GNU General Public License (GPL) with additional restrictions limiting use to academic, research, and educational purposes. It ensures that users have the freedom to study, modify, and share the software while prohibiting commercial exploitation.
|
4
|
+
|
5
|
+
2. Grant of LicenseThis software is licensed under the GPL with the following additional condition: You may use, modify, and distribute this software only for academic, research, and educational purposes. Any commercial use, including but not limited to for-profit applications, services, or product development, is strictly prohibited.
|
6
|
+
|
7
|
+
3. RestrictionsYou may not:
|
8
|
+
|
9
|
+
Use the software for commercial, business, or for-profit purposes.
|
10
|
+
|
11
|
+
Distribute, sublicense, or sell copies of the software for commercial purposes.
|
12
|
+
|
13
|
+
Remove or alter any copyright, trademark, or proprietary notices.
|
14
|
+
|
15
|
+
4. Compliance with GPLAs this software is based on the GPL, you must also:
|
16
|
+
|
17
|
+
Include a copy of this license with any distribution.
|
18
|
+
|
19
|
+
Provide access to the source code when distributing the software.
|
20
|
+
|
21
|
+
Allow modifications and redistribution under these same terms.
|
22
|
+
|
23
|
+
5. Disclaimer of WarrantyThis software is provided "as is" without any warranties, express or implied. The author disclaims any liability for damages arising from its use.
|
24
|
+
|
25
|
+
6. TerminationThis license is effective until terminated. If you violate any terms, your rights under this license will terminate automatically, and you must cease using the software and delete all copies.
|
26
|
+
|
27
|
+
7. Governing LawThis agreement shall be governed by and construed in accordance with the laws of [Your Jurisdiction].
|
28
|
+
|
29
|
+
By using this software, you agree to abide by the terms of this license and the GNU General Public License.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: PySimultan
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.4
|
4
4
|
Project-URL: Documentation, https://github.com/Bühler Maximilian/PySimultan2#readme
|
5
5
|
Project-URL: Issues, https://github.com/Bühler Maximilian/PySimultan2/issues
|
6
6
|
Project-URL: Source, https://github.com/Bühler Maximilian/PySimultan2
|
@@ -166,6 +166,9 @@ print(instances[0].param_1)
|
|
166
166
|
|
167
167
|
|
168
168
|
# Change Log
|
169
|
+
## [0.6.4] - 2025-06-06
|
170
|
+
Updated SIMULTAN version to 0.7.18
|
171
|
+
|
169
172
|
## [0.5.9.7] - 2025-01-09
|
170
173
|
- Added default component support to Mapper: if a default component is not present in the datamodel, it is automatically added
|
171
174
|
- Fixed content naming bug: Content.name is now used for the name of the TaxonomyEntry in SIMULTAN
|
@@ -137,6 +137,9 @@ print(instances[0].param_1)
|
|
137
137
|
|
138
138
|
|
139
139
|
# Change Log
|
140
|
+
## [0.6.4] - 2025-06-06
|
141
|
+
Updated SIMULTAN version to 0.7.18
|
142
|
+
|
140
143
|
## [0.5.9.7] - 2025-01-09
|
141
144
|
- Added default component support to Mapper: if a default component is not present in the datamodel, it is automatically added
|
142
145
|
- Fixed content naming bug: Content.name is now used for the name of the TaxonomyEntry in SIMULTAN
|
@@ -1,6 +1,13 @@
|
|
1
|
+
Version 0.6.2 (28.03.2024)
|
2
|
+
- Added extended functionality to ComponentDictionary
|
3
|
+
- Bugfixing
|
4
|
+
|
1
5
|
Version 0.6.1 (24.02.2024)
|
2
6
|
- Bugfixes in default_types and File/Directory handling
|
3
7
|
|
8
|
+
Version 0.6.0.7 (16.02.2024)
|
9
|
+
- Fixed Asset creation and deletion bugs
|
10
|
+
|
4
11
|
Version 0.6.0.3 (23.01.2024)
|
5
12
|
- Added sub_classes and super_classes to SimultanObject
|
6
13
|
|
@@ -0,0 +1 @@
|
|
1
|
+
version = '0.6.4'
|
@@ -603,7 +603,7 @@ class DataModel:
|
|
603
603
|
try:
|
604
604
|
act_filename = filename.replace('\\', os.sep)
|
605
605
|
except TypeError:
|
606
|
-
act_filename = filename
|
606
|
+
act_filename = str(filename)
|
607
607
|
|
608
608
|
if not act_filename.startswith(self.project.ProjectUnpackFolder.FullPath) and target_dir is None:
|
609
609
|
target_dir_str = self.project.ProjectUnpackFolder.FullPath
|
@@ -520,11 +520,13 @@ class ComponentDictionary(SimultanObject):
|
|
520
520
|
|
521
521
|
def __setitem__(self, key, value):
|
522
522
|
|
523
|
-
if key in self._dict:
|
524
|
-
|
523
|
+
# if key in self._dict:
|
524
|
+
# del self._dict[key]
|
525
525
|
|
526
526
|
if key in self._taxonomy_map.content_dict.keys():
|
527
527
|
content = self._taxonomy_map.content_dict[key]
|
528
|
+
elif '__dict_key__' + key in self._taxonomy_map.content_dict.keys():
|
529
|
+
content = self._taxonomy_map.content_dict['__dict_key__' + key]
|
528
530
|
else:
|
529
531
|
content = Content(text_or_key=f'__dict_key__{key}',
|
530
532
|
property_name=key,
|
@@ -574,7 +576,10 @@ class ComponentDictionary(SimultanObject):
|
|
574
576
|
|
575
577
|
def __delitem__(self, key):
|
576
578
|
self[key] = None
|
577
|
-
|
579
|
+
try:
|
580
|
+
del self._dict[key]
|
581
|
+
except KeyError:
|
582
|
+
pass
|
578
583
|
|
579
584
|
def items(self):
|
580
585
|
if self._dict is None or not self._dict:
|
@@ -307,6 +307,8 @@ class FileInfo(object, metaclass=MetaMock):
|
|
307
307
|
full_path = os.path.join(target_dir.CurrentFullPath, filename)
|
308
308
|
elif isinstance(target_dir, str):
|
309
309
|
full_path = os.path.join(target_dir, filename)
|
310
|
+
else:
|
311
|
+
raise ValueError(f'Unsupported target_dir format')
|
310
312
|
else:
|
311
313
|
if not filename.startswith(str(data_model.project.ProjectUnpackFolder)):
|
312
314
|
full_path = os.path.join(str(data_model.project.ProjectUnpackFolder), filename)
|
@@ -614,6 +616,15 @@ class DirectoryInfo(object, metaclass=DirectoryInfoMetaMock):
|
|
614
616
|
add_sub_directories: bool = True,
|
615
617
|
*args,
|
616
618
|
**kwargs) -> DirectoryInfo:
|
619
|
+
"""
|
620
|
+
Create a directory info object from an existing directory.
|
621
|
+
:param directory_path: the path to the directory
|
622
|
+
:param add_files:
|
623
|
+
:param add_sub_directories:
|
624
|
+
:param args:
|
625
|
+
:param kwargs:
|
626
|
+
:return:
|
627
|
+
"""
|
617
628
|
|
618
629
|
data_model = kwargs.get('data_model', config.get_default_data_model())
|
619
630
|
|
@@ -647,6 +658,33 @@ class DirectoryInfo(object, metaclass=DirectoryInfoMetaMock):
|
|
647
658
|
|
648
659
|
return directory_info
|
649
660
|
|
661
|
+
@classmethod
|
662
|
+
def from_existing_directory_copy(cls,
|
663
|
+
directory_path: str,
|
664
|
+
destination_path: str,
|
665
|
+
add_files: bool = True,
|
666
|
+
add_sub_directories: bool = True,
|
667
|
+
*args,
|
668
|
+
**kwargs) -> DirectoryInfo:
|
669
|
+
|
670
|
+
"""
|
671
|
+
Create a directory info object from an existing directory which is copied to a directory in the project.
|
672
|
+
:param directory_path:
|
673
|
+
:param destination_path: the path to the directory (in the project)
|
674
|
+
:param add_files:
|
675
|
+
:param add_sub_directories:
|
676
|
+
:param args:
|
677
|
+
:param kwargs:
|
678
|
+
:return:
|
679
|
+
"""
|
680
|
+
|
681
|
+
shutil.copytree(directory_path, destination_path)
|
682
|
+
return cls.from_existing_directory(destination_path,
|
683
|
+
add_files=add_files,
|
684
|
+
add_sub_directories=add_sub_directories,
|
685
|
+
*args,
|
686
|
+
**kwargs)
|
687
|
+
|
650
688
|
def __init__(self,
|
651
689
|
path: Optional[str] = None,
|
652
690
|
helper_file: Optional[FileInfo] = None,
|
@@ -781,11 +819,7 @@ class DirectoryInfo(object, metaclass=DirectoryInfoMetaMock):
|
|
781
819
|
|
782
820
|
def get_file(self, filename: str) -> Optional[FileInfo]:
|
783
821
|
resource = next((x for x in self.files if x.resource_entry.Name == filename), None)
|
784
|
-
|
785
|
-
return FileInfo(resource_entry=resource,
|
786
|
-
data_model=self.data_model)
|
787
|
-
else:
|
788
|
-
return None
|
822
|
+
return resource
|
789
823
|
|
790
824
|
def add_file(self,
|
791
825
|
filename: str,
|
@@ -129,7 +129,9 @@ def simultan_multi_value_big_table_to_pandas(field: SimMultiValueBigTable) -> pd
|
|
129
129
|
return df
|
130
130
|
|
131
131
|
|
132
|
-
def simultan_multi_value_field_3d_to_numpy(field: SimMultiValueField3D,
|
132
|
+
def simultan_multi_value_field_3d_to_numpy(field: SimMultiValueField3D,
|
133
|
+
assert_ordered=False,
|
134
|
+
squeeze: bool = True) -> np.ndarray:
|
133
135
|
"""
|
134
136
|
Convert a SimMultiValueField3D object to a numpy array.
|
135
137
|
:param field:
|
@@ -150,7 +152,10 @@ def simultan_multi_value_field_3d_to_numpy(field: SimMultiValueField3D, assert_o
|
|
150
152
|
for comb in product(range(len(field.XAxis)), range(len(field.YAxis)), range(len(field.ZAxis)), repeat=1):
|
151
153
|
array[comb[0], comb[1], comb[2]] = field[comb[0], comb[1], comb[2]]
|
152
154
|
|
153
|
-
|
155
|
+
if squeeze:
|
156
|
+
return np.squeeze(array)
|
157
|
+
else:
|
158
|
+
return array
|
154
159
|
|
155
160
|
|
156
161
|
def add_field_to_data_model(field: SimMultiValueField3D, data_model: 'SimultanObject') -> SimMultiValueField3D:
|
@@ -288,3 +293,55 @@ def create_field_parameter(value: Union[SimMultiValueField3D, np.ndarray, DataFr
|
|
288
293
|
)
|
289
294
|
|
290
295
|
return param
|
296
|
+
|
297
|
+
|
298
|
+
def add_row(field: SimMultiValueField3D,
|
299
|
+
dim: int = 0):
|
300
|
+
|
301
|
+
array = simultan_multi_value_field_3d_to_numpy(field, squeeze=False)
|
302
|
+
|
303
|
+
new_shape = list(array.shape)
|
304
|
+
if new_shape.__len__() - 1 < dim:
|
305
|
+
while new_shape.__len__() - 1 < dim:
|
306
|
+
new_shape.append(1)
|
307
|
+
new_shape[dim] += 1
|
308
|
+
|
309
|
+
# data = NetList[Double](Array[Double](array.astype(float).flatten(order='F')))
|
310
|
+
|
311
|
+
while field.XAxis.Count < new_shape[0]:
|
312
|
+
field.XAxis.Add(field.XAxis.Count+1)
|
313
|
+
while field.YAxis.Count < new_shape[1]:
|
314
|
+
field.YAxis.Add(field.YAxis.Count+1)
|
315
|
+
while field.ZAxis.Count < new_shape[2]:
|
316
|
+
field.ZAxis.Add(field.ZAxis.Count+1)
|
317
|
+
|
318
|
+
resized_array = np.resize(array, new_shape)
|
319
|
+
|
320
|
+
for i, j, k in zip(range(new_shape[0]), range(new_shape[1]), range(new_shape[2])):
|
321
|
+
field[i, j, k] = resized_array[i, j, k]
|
322
|
+
|
323
|
+
return field
|
324
|
+
|
325
|
+
|
326
|
+
def resize(field: SimMultiValueField3D,
|
327
|
+
new_shape: list[int]) -> SimMultiValueField3D:
|
328
|
+
"""
|
329
|
+
Resize a SimMultiValueField3D object to a new shape.
|
330
|
+
:param field: The SimMultiValueField3D object
|
331
|
+
:param new_shape: The new shape of the field, e.g. [10, 20, 30]
|
332
|
+
:return: SimMultiValueField3D
|
333
|
+
"""
|
334
|
+
array = simultan_multi_value_field_3d_to_numpy(field, squeeze=False)
|
335
|
+
resized_array = np.resize(array, new_shape)
|
336
|
+
|
337
|
+
while field.XAxis.Count < resized_array.shape[0]:
|
338
|
+
field.XAxis.Add(field.XAxis.Count+1)
|
339
|
+
while field.YAxis.Count < resized_array.shape[1]:
|
340
|
+
field.YAxis.Add(field.YAxis.Count+1)
|
341
|
+
while field.ZAxis.Count < resized_array.shape[2]:
|
342
|
+
field.ZAxis.Add(field.ZAxis.Count+1)
|
343
|
+
|
344
|
+
for i, j, k in zip(range(new_shape[0]), range(new_shape[1]), range(new_shape[2])):
|
345
|
+
field[i, j, k] = resized_array[i, j, k]
|
346
|
+
|
347
|
+
return field
|