PySimultan 0.6.1__tar.gz → 0.6.2__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.2/LICENSE.txt +29 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/PKG-INFO +1 -1
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/CHANGELOG.md +7 -0
- pysimultan-0.6.2/src/PySimultan2/__about__.py +1 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/default_types.py +8 -3
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/files.py +39 -5
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/multi_values.py +59 -2
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/utils.py +3 -2
- pysimultan-0.6.2/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 → pysimultan-0.6.2}/.gitignore +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/README.md +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/pyproject.toml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/data_model.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/geometry/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/geometry/geometry_base.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/geometry/utils.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/object_mapper.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/AssimpNet.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/AvalonDock.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/BruTile.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/ClosedXML.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/ComponentBuilder.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/ComponentBuilder.dll.config +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/ComponentBuilder.runtimeconfig.json +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/ComponentBuilder.xml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/ControlzEx.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/DocumentFormat.OpenXml.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/DotSpatial.Projections.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/ExcelNumberFormat.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Fluent.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/HelixToolkit.Core.Wpf.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/HelixToolkit.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/MathNet.Numerics.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.AspNetCore.Authorization.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.Extensions.Options.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.Extensions.Primitives.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.Shell.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.Xaml.Behaviors.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Newtonsoft.Json.Bson.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Newtonsoft.Json.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Python.Runtime.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SIMULTAN.Lang.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SIMULTAN.Lang.xml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SIMULTAN.UI.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SIMULTAN.UI.xml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SIMULTAN.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SIMULTAN.xml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SharpDX.D3DCompiler.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SharpDX.DXGI.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SharpDX.Direct2D1.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SharpDX.Direct3D11.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SharpDX.Direct3D9.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SharpDX.Mathematics.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/SharpDX.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Sprache.Calc.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Sprache.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/System.Collections.Immutable.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/System.Data.OleDb.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/System.Net.Http.Formatting.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/System.Reflection.Metadata.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/System.Reflection.MetadataLoadContext.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/XAMLMarkupExtensions.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/assimp.dll +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/componentmanager.user +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/defaultsettings.xml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/setup.bat +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/simultan_object.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/taxonomy_maps.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/type_setter_lookup.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/RoomAcoustics_V02.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/create_component.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/create_component_with_taxonomy_slot.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/create_referenced_component.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/create_taxonomies.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/empty_test_excel.xlsx +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_example3.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_example4.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_example_create_typed_component.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_example_create_typed_component_with_slots.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_example_extend.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_example_update_references.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_reference_list.yml +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/resources/__init__.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/resources/new_test_file.txt +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/resources/new_test_file2.txt +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_calc_static_zone_temperature.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_calculate_steady_state_temperature.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_circular_references.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_create_geometry.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_default_component.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_directory_and_files.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_files.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_files_load.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_load_geometry.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_load_multi_values.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_new_dll.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_new_project_creation.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_numeric_map.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_parameter_reference.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_pythonnet.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_register_class.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_register_decorator.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_set_attr_property.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_set_dictionary.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_set_properties.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_taxonomie_maps.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_taxonomies.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/tests/test_ui.py +0 -0
- {pysimultan-0.6.1 → pysimultan-0.6.2}/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.2
|
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
|
@@ -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.2'
|
@@ -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
|
@@ -2,11 +2,12 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import sys
|
4
4
|
import traceback
|
5
|
+
import functools
|
6
|
+
import numpy as np
|
7
|
+
import pandas as pd
|
5
8
|
|
6
9
|
from enum import Enum
|
7
10
|
from weakref import WeakSet
|
8
|
-
import numpy as np
|
9
|
-
import pandas as pd
|
10
11
|
from typing import List as TypeList, Union, Optional, Type, Any, TYPE_CHECKING
|
11
12
|
from SIMULTAN.Data import SimId
|
12
13
|
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import numpy as np
|
2
|
+
|
3
|
+
from PySimultan2.data_model import DataModel
|
4
|
+
from PySimultan2.object_mapper import PythonMapper
|
5
|
+
from PySimultan2.taxonomy_maps import TaxonomyMap, Content
|
6
|
+
from PySimultan2.multi_values import simultan_multi_value_field_3d_to_numpy, add_row
|
7
|
+
|
8
|
+
|
9
|
+
import resources
|
10
|
+
|
11
|
+
try:
|
12
|
+
import importlib.resources as pkg_resources
|
13
|
+
except ImportError:
|
14
|
+
# Try backported to PY<37 importlib_resources.
|
15
|
+
import importlib_resources as pkg_resources
|
16
|
+
|
17
|
+
|
18
|
+
with pkg_resources.path(resources, 'test_set_dictionary.simultan') as r_path:
|
19
|
+
project_path = str(r_path)
|
20
|
+
|
21
|
+
|
22
|
+
data_model = DataModel.create_new_project(project_path=project_path,
|
23
|
+
user_name='admin',
|
24
|
+
password='admin')
|
25
|
+
|
26
|
+
mapper = PythonMapper()
|
27
|
+
|
28
|
+
|
29
|
+
def map_classes():
|
30
|
+
class TestComponent(object):
|
31
|
+
def __init__(self, *args, **kwargs):
|
32
|
+
self.mapped_property = kwargs.get('mapped_property')
|
33
|
+
self.value2 = kwargs.get('value2')
|
34
|
+
|
35
|
+
content0 = Content(text_or_key='value', # text or key of the content/parameter/property
|
36
|
+
property_name='mapped_property', # name of the generated property
|
37
|
+
type=None, # type of the content/parameter/property
|
38
|
+
unit=None, # unit of the content/parameter/property
|
39
|
+
documentation='mapped_property to test',
|
40
|
+
component_policy='subcomponent')
|
41
|
+
|
42
|
+
content1 = Content(text_or_key='value2', # text or key of the content/parameter/property
|
43
|
+
property_name='value2', # name of the generated property
|
44
|
+
type=None, # type of the content/parameter/property
|
45
|
+
unit=None, # unit of the content/parameter/property
|
46
|
+
documentation='value2',
|
47
|
+
component_policy='reference')
|
48
|
+
|
49
|
+
test_component_map = TaxonomyMap(taxonomy_name='PySimultan',
|
50
|
+
taxonomy_key='PySimultan',
|
51
|
+
taxonomy_entry_name='TestComponent',
|
52
|
+
taxonomy_entry_key='TestComponent',
|
53
|
+
content=[content0, content1],
|
54
|
+
)
|
55
|
+
|
56
|
+
mapper.register(test_component_map.taxonomy_entry_key, TestComponent, taxonomy_map=test_component_map)
|
57
|
+
cls1 = mapper.get_mapped_class(test_component_map.taxonomy_entry_key)
|
58
|
+
|
59
|
+
|
60
|
+
return cls1
|
61
|
+
|
62
|
+
|
63
|
+
mapped_cls_1 = map_classes()
|
64
|
+
component = mapped_cls_1(name='test_component',
|
65
|
+
mapped_property=None)
|
66
|
+
|
67
|
+
|
68
|
+
def test_set_dictionary_param(component):
|
69
|
+
|
70
|
+
component_1 = mapped_cls_1(name='test_component_1',
|
71
|
+
mapped_property=np.array([1, 2, 3]),
|
72
|
+
value2=np.array([[1, 2, 3], [4, 5, 6]]))
|
73
|
+
|
74
|
+
field1 = component_1.get_raw_attr('mapped_property').ValueSource.Field
|
75
|
+
field2 = component_1.get_raw_attr('value2').ValueSource.Field
|
76
|
+
|
77
|
+
add_row(field1, 0)
|
78
|
+
add_row(field2, 0)
|
79
|
+
|
80
|
+
|
81
|
+
def load_data_model(data_model: DataModel):
|
82
|
+
data_model = DataModel(project_path=project_path,
|
83
|
+
user_name='admin',
|
84
|
+
password='admin')
|
85
|
+
typed_data = data_model.get_typed_data(mapper=mapper,
|
86
|
+
create_all=True)
|
87
|
+
|
88
|
+
TestComponent = mapper.get_mapped_class('TestComponent')
|
89
|
+
test_component = TestComponent.cls_instances[0]
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
return data_model
|
94
|
+
|
95
|
+
|
96
|
+
if __name__ == '__main__':
|
97
|
+
test_set_dictionary_param(component)
|
98
|
+
data_model.save()
|
99
|
+
mapper.clear()
|
100
|
+
data_model.cleanup()
|
101
|
+
data_model = DataModel(project_path=project_path,
|
102
|
+
user_name='admin',
|
103
|
+
password='admin')
|
104
|
+
load_data_model(data_model)
|
105
|
+
|
106
|
+
|
107
|
+
data_model.cleanup()
|
108
|
+
print('Test passed')
|
pysimultan-0.6.1/LICENSE.txt
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2024-present Bühler Maximilian <maximilian.buehler@a1.digital>
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
-
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
-
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1 +0,0 @@
|
|
1
|
-
version = '0.6.1'
|
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
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/ComponentBuilder.runtimeconfig.json
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll
RENAMED
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.Extensions.Options.dll
RENAMED
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.Extensions.Primitives.dll
RENAMED
File without changes
|
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.dll
RENAMED
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/Microsoft.Xaml.Behaviors.dll
RENAMED
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
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/System.Collections.Immutable.dll
RENAMED
File without changes
|
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/System.Net.Http.Formatting.dll
RENAMED
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/src/PySimultan2/resources/System.Reflection.Metadata.dll
RENAMED
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
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/create_component_with_taxonomy_slot.py
RENAMED
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
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_example_extend.yml
RENAMED
File without changes
|
File without changes
|
{pysimultan-0.6.1 → pysimultan-0.6.2}/tests/readme_examples/resources/template_reference_list.yml
RENAMED
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
|