honeybee-radiance-postprocess 0.4.585__tar.gz → 0.4.587__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 (64) hide show
  1. honeybee_radiance_postprocess-0.4.587/CUPY.MD +88 -0
  2. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/PKG-INFO +3 -2
  3. honeybee_radiance_postprocess-0.4.587/honeybee_radiance_postprocess/__init__.py +36 -0
  4. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/annual.py +2 -8
  5. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/annualdaylight.py +2 -10
  6. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/annualirradiance.py +0 -1
  7. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/breeam/breeam.py +1 -6
  8. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/abnt.py +1 -6
  9. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/datacollection.py +3 -7
  10. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/grid.py +3 -7
  11. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/merge.py +3 -7
  12. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/mtxop.py +1 -6
  13. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/postprocess.py +1 -6
  14. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/translate.py +2 -7
  15. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/two_phase.py +1 -6
  16. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/util.py +2 -1
  17. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/viewfactor.py +3 -7
  18. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/data_type.py +2 -6
  19. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/electriclight.py +1 -6
  20. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/en17037.py +1 -6
  21. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/helper.py +41 -21
  22. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/ies/lm.py +1 -6
  23. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/ies/lm_schedule.py +1 -6
  24. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/leed/leed.py +1 -8
  25. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/leed/leed_schedule.py +1 -6
  26. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/metrics.py +54 -32
  27. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/reader.py +1 -7
  28. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/results/annual_daylight.py +2 -9
  29. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/results/annual_irradiance.py +1 -6
  30. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/results/results.py +1 -8
  31. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/type_hints.py +2 -6
  32. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/util.py +1 -7
  33. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/well/well.py +1 -1
  34. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess.egg-info/PKG-INFO +3 -2
  35. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess.egg-info/SOURCES.txt +1 -0
  36. honeybee_radiance_postprocess-0.4.587/honeybee_radiance_postprocess.egg-info/requires.txt +3 -0
  37. honeybee_radiance_postprocess-0.4.587/requirements.txt +3 -0
  38. honeybee_radiance_postprocess-0.4.585/honeybee_radiance_postprocess/well/__init__.py +0 -1
  39. honeybee_radiance_postprocess-0.4.585/honeybee_radiance_postprocess.egg-info/requires.txt +0 -2
  40. honeybee_radiance_postprocess-0.4.585/requirements.txt +0 -2
  41. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/CODE_OF_CONDUCT.md +0 -0
  42. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/CONTRIBUTING.md +0 -0
  43. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/LICENSE +0 -0
  44. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/MANIFEST.in +0 -0
  45. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/README.md +0 -0
  46. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/dev-requirements.txt +0 -0
  47. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/__main__.py +0 -0
  48. {honeybee_radiance_postprocess-0.4.585/honeybee_radiance_postprocess → honeybee_radiance_postprocess-0.4.587/honeybee_radiance_postprocess/breeam}/__init__.py +0 -0
  49. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/__init__.py +0 -0
  50. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/breeam.py +0 -0
  51. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/leed.py +0 -0
  52. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/schedule.py +0 -0
  53. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/cli/well.py +0 -0
  54. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/dynamic.py +0 -0
  55. {honeybee_radiance_postprocess-0.4.585/honeybee_radiance_postprocess/breeam → honeybee_radiance_postprocess-0.4.587/honeybee_radiance_postprocess/ies}/__init__.py +0 -0
  56. {honeybee_radiance_postprocess-0.4.585/honeybee_radiance_postprocess/ies → honeybee_radiance_postprocess-0.4.587/honeybee_radiance_postprocess/leed}/__init__.py +0 -0
  57. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/results/__init__.py +0 -0
  58. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess/vis_metadata.py +0 -0
  59. {honeybee_radiance_postprocess-0.4.585/honeybee_radiance_postprocess/leed → honeybee_radiance_postprocess-0.4.587/honeybee_radiance_postprocess/well}/__init__.py +0 -0
  60. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess.egg-info/dependency_links.txt +0 -0
  61. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess.egg-info/entry_points.txt +0 -0
  62. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/honeybee_radiance_postprocess.egg-info/top_level.txt +0 -0
  63. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/setup.cfg +0 -0
  64. {honeybee_radiance_postprocess-0.4.585 → honeybee_radiance_postprocess-0.4.587}/setup.py +0 -0
@@ -0,0 +1,88 @@
1
+ # CuPy installation guide
2
+
3
+ ## :white_check_mark: CuPy requirements
4
+
5
+ * You have an NVIDIA GPU.
6
+ * Your GPU's compute capability is supported by CuPy.
7
+ * You have a suitable CUDA Toolkit installed (matching the CuPy package variant).
8
+ * Your GPU driver supports the CUDA version you intend to use.
9
+
10
+ ## :wrench: Compute Capability
11
+
12
+ ### What is Compute Capability
13
+ Compute capability is a number that describes the feature set and performance characteristics of your NVIDIA GPU architecture.
14
+
15
+ CuPy supports GPUs with compute capability ≥ 3.0.
16
+
17
+ Examples:
18
+ * NVIDIA GTX 1080 → Compute Capability **6.1**.
19
+ * NVIDIA GTX 2080 → Compute Capability **7.5**.
20
+ * NVIDIA RTX 3080 → Compute Capability **8.6**.
21
+ * NVIDIA RTX 4090 → Compute Capability **8.9**.
22
+ * NVIDIA RTX 5090 → Compute Capability **12.0**.
23
+
24
+ You can find the compute capability of your GPU [here](https://developer.nvidia.com/cuda-gpus). If you have an older GPU, such as the GTX 10 series or older, please check [this](https://developer.nvidia.com/cuda-legacy-gpus) list.
25
+
26
+ If you are still not sure about your compute capability, you can query it through CuPy once it is installed:
27
+
28
+ ```python
29
+ import cupy as cp
30
+
31
+ print(cp.cuda.Device().compute_capability)
32
+ ```
33
+
34
+ This prints the major index and minor index as a string, e.g., '75' for version 7.5.
35
+
36
+ ## :toolbox: CUDA Toolkit
37
+
38
+ ### What is CUDA Toolkit
39
+ The CUDA Toolkit provides the underlying CUDA libraries, runtime, and compiler that CuPy uses to run GPU code. CuPy depends on a matching CUDA Toolkit and GPU driver that supports your GPU.
40
+
41
+ ### Picking the correct CUDA version
42
+
43
+ You can find the CUDA version supported by your GPU driver by executing [nvidia-smi](https://docs.nvidia.com/deploy/nvidia-smi/index.html) in the command prompt.
44
+
45
+ ```
46
+ C:\Users\USERNAME>nvidia-smi
47
+ +-----------------------------------------------------------------------------------------+
48
+ | NVIDIA-SMI 581.80 Driver Version: 581.80 CUDA Version: 13.0 |
49
+ +-----------------------------------------+------------------------+----------------------+
50
+ ```
51
+
52
+ Please note that the CUDA version reported by nvidia-smi is not the installed version of the CUDA Toolkit; it is the latest API compatible version for your GPU driver. If your GPU driver is not up to date you might not see the latest CUDA version.
53
+
54
+ ### Installing CUDA Toolkit
55
+
56
+ You can download the latest version of CUDA Toolkit [here](https://developer.nvidia.com/cuda-downloads). If your GPU driver does not support the latest version, you can select a compatible version in the [archive](https://developer.nvidia.com/cuda-toolkit-archive).
57
+
58
+ ## :package: Installing CuPy
59
+
60
+ CuPy provides prebuilt binary wheels tied to CUDA versions. You should install the wheel matching your installed CUDA Toolkit.
61
+
62
+ | CUDA Toolkit | Command |
63
+ | ------------------- | ------------------------ |
64
+ | CUDA 13.x | pip install cupy-cuda13x |
65
+ | CUDA 12.x | pip install cupy-cuda12x |
66
+ | CUDA 11.x (>= 11.2) | pip install cupy-cuda11x |
67
+
68
+ ## :question: FAQ
69
+
70
+ ### Can I use CuPy with an AMD GPU?
71
+
72
+ If you have an AMD GPU please read [this](https://docs.cupy.dev/en/stable/install.html#using-cupy-on-amd-gpu-experimental).
73
+
74
+ ### How can I tell if honeybee-radiance-process is using CuPy and not NumPy?
75
+
76
+ honeybee-radiance-postprocess will print a line that tells you if CuPy is being used. You should see something like this:
77
+
78
+ `Using CuPy (13.6.0) for GPU (NVIDIA GeForce RTX 3080) acceleration in honeybee-radiance-postprocess.`
79
+
80
+ If CuPy *is* installed but fails during initialization honeybee-radiance-postprocess will fall back to NumPy. If this happens you should see a statement similar to this:
81
+
82
+ `Failed to load CuPy successfully. Falling back to NumPy (1.26.4) in honeybee-radiance-postprocess`
83
+
84
+ ## :warning: Common Errors
85
+
86
+ `FileNotFoundError: Could not find module 'nvrtc64_130_0.dll' (or one of its dependencies). Try using the full path with constructor syntax.`
87
+
88
+ This is possibly caused by a mismatch between the CUDA Toolkit version and the CuPy version, e.g., cupy-cuda13x and CUDA Toolkit 12.9.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: honeybee-radiance-postprocess
3
- Version: 0.4.585
3
+ Version: 0.4.587
4
4
  Summary: Postprocessing of Radiance results and matrices
5
5
  Home-page: https://github.com/ladybug-tools/honeybee-radiance-postprocess
6
6
  Author: Ladybug Tools
@@ -16,8 +16,9 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
16
16
  Classifier: Operating System :: OS Independent
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: honeybee-radiance==1.66.216
19
+ Requires-Dist: honeybee-radiance==1.66.217
20
20
  Requires-Dist: numpy<2.0.0
21
+ Requires-Dist: cupy-cuda12x==13.6.0
21
22
  Dynamic: author
22
23
  Dynamic: author-email
23
24
  Dynamic: classifier
@@ -0,0 +1,36 @@
1
+ """honeybee-radiance-postprocess library."""
2
+ import sys
3
+
4
+ IS_GPU = False
5
+
6
+ if sys.version_info >= (3, 0):
7
+ try:
8
+ import cupy as np
9
+ np.arange(1)
10
+ IS_GPU = True
11
+ try:
12
+ device_id = np.cuda.runtime.getDevice()
13
+ device_props = np.cuda.runtime.getDeviceProperties(device_id)
14
+ device_name = device_props['name'].decode()
15
+ except Exception:
16
+ device_name = 'Unknown GPU'
17
+
18
+ msg = (
19
+ 'Using CuPy ({}) for GPU ({}) acceleration in '
20
+ 'honeybee-radiance-postprocess.'
21
+ ).format(np.__version__, device_name)
22
+ sys.stderr.write(msg)
23
+
24
+ except ModuleNotFoundError:
25
+ import numpy as np
26
+
27
+ except Exception as e:
28
+ import numpy as np
29
+ msg = (
30
+ 'Failed to load CuPy successfully. '
31
+ 'Help: https://github.com/ladybug-tools/honeybee-radiance-postprocess/blob/master/CUPY.md. '
32
+ 'Falling back to NumPy ({}) in honeybee-radiance-postprocess: {}'
33
+ ).format(np.__version__, e)
34
+ sys.stderr.write(msg)
35
+
36
+ IS_CPU = not IS_GPU
@@ -1,16 +1,10 @@
1
1
  """Shared functions for post-processing annual results."""
2
2
  from typing import Union
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
9
3
 
10
4
  from ladybug.analysisperiod import AnalysisPeriod
11
- from .util import filter_array
12
5
 
13
- is_cpu = not is_gpu
6
+ from . import np
7
+ from .util import filter_array
14
8
 
15
9
 
16
10
  def occupancy_schedule_8_to_6(
@@ -1,15 +1,6 @@
1
- """Functions for post-processing annual daylight outputs.
2
-
3
- Note: These functions will most likely be moved to a separate package in the near future.
4
- """
1
+ """Functions for post-processing annual daylight outputs."""
5
2
  import json
6
3
  import os
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
13
4
 
14
5
  from ladybug.color import Colorset
15
6
  from ladybug.datatype.fraction import Fraction
@@ -17,6 +8,7 @@ from ladybug.legend import LegendParameters
17
8
  from honeybee_radiance.postprocess.annual import filter_schedule_by_hours, \
18
9
  _process_input_folder
19
10
 
11
+ from . import np
20
12
  from .metrics import da_array2d, cda_array2d, udi_array2d, \
21
13
  udi_lower_array2d, udi_upper_array2d
22
14
  from .util import filter_array
@@ -1,5 +1,4 @@
1
1
  """Functions for post-processing annual irradiance outputs."""
2
-
3
2
  from ladybug.datatype.energyflux import EnergyFlux
4
3
  from ladybug.datatype.energyintensity import EnergyIntensity
5
4
  from ladybug.legend import LegendParameters
@@ -2,16 +2,11 @@
2
2
  from typing import Union
3
3
  from pathlib import Path
4
4
  import json
5
- try:
6
- import cupy as np
7
- is_gpu = True
8
- except ImportError:
9
- is_gpu = False
10
- import numpy as np
11
5
 
12
6
  from honeybee.model import Model
13
7
  from honeybee_radiance.writer import _filter_by_pattern
14
8
 
9
+ from .. import np
15
10
  from ..results.annual_daylight import AnnualDaylight
16
11
 
17
12
 
@@ -4,18 +4,13 @@ import sys
4
4
  import logging
5
5
  from pathlib import Path
6
6
  import click
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
13
7
 
14
8
  from honeybee.model import Model
15
9
  from honeybee.room import Room
16
10
  from ladybug_geometry.geometry3d.face import Face3D
17
11
  from ladybug_geometry.geometry3d.pointvector import Vector3D
18
12
 
13
+ from .. import np
19
14
  from ..vis_metadata import _abnt_nbr_15575_daylight_levels_vis_metadata
20
15
 
21
16
 
@@ -1,21 +1,17 @@
1
1
  """Commands to work with data collections."""
2
2
  import sys
3
3
  import logging
4
+ import json
4
5
  from pathlib import Path
5
6
  import click
6
- import json
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
13
7
 
14
8
  from ladybug.datacollection import HourlyContinuousCollection, \
15
9
  HourlyDiscontinuousCollection
16
10
  from ladybug.header import Header
17
11
  from ladybug.datautil import collections_to_csv
18
12
 
13
+ from .. import np
14
+
19
15
 
20
16
  _logger = logging.getLogger(__name__)
21
17
 
@@ -1,17 +1,13 @@
1
1
  """honeybee radiance postprocess grid commands."""
2
- import click
3
2
  import sys
4
3
  import logging
5
4
  import json
6
5
  from pathlib import Path
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
6
+ import click
13
7
 
14
8
  from honeybee_radiance_postprocess.reader import binary_to_array
9
+
10
+ from .. import np
15
11
  from ..annualdaylight import _annual_daylight_vis_metadata
16
12
 
17
13
  _logger = logging.getLogger(__name__)
@@ -1,18 +1,14 @@
1
1
  """honeybee radiance postprocess merge commands."""
2
- import click
3
2
  import sys
4
3
  import logging
5
4
  import json
6
5
  from pathlib import Path
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
6
+ import click
13
7
 
14
8
  from honeybee_radiance_postprocess.reader import binary_to_array
15
9
 
10
+ from .. import np
11
+
16
12
  _logger = logging.getLogger(__name__)
17
13
 
18
14
 
@@ -3,13 +3,8 @@ import sys
3
3
  import logging
4
4
  from pathlib import Path
5
5
  import click
6
- try:
7
- import cupy as np
8
- is_gpu = True
9
- except ImportError:
10
- is_gpu = False
11
- import numpy as np
12
6
 
7
+ from .. import np
13
8
  from ..reader import binary_to_array, ascii_to_array
14
9
 
15
10
  _logger = logging.getLogger(__name__)
@@ -5,12 +5,6 @@ import os
5
5
  import logging
6
6
  import json
7
7
  import click
8
- try:
9
- import cupy as np
10
- is_gpu = True
11
- except ImportError:
12
- is_gpu = False
13
- import numpy as np
14
8
 
15
9
  from ladybug.location import Location
16
10
  from ladybug.wea import Wea
@@ -19,6 +13,7 @@ from honeybee_radiance_postprocess.metrics import da_array2d, cda_array2d, \
19
13
  udi_array2d, udi_lower_array2d, udi_upper_array2d
20
14
  from honeybee_radiance_postprocess.reader import binary_to_array
21
15
 
16
+ from .. import np
22
17
  from ..annual import occupancy_schedule_8_to_6
23
18
  from ..dynamic import DynamicSchedule
24
19
  from ..en17037 import en17037_to_folder
@@ -3,15 +3,10 @@ import sys
3
3
  import logging
4
4
  from pathlib import Path
5
5
  import shutil
6
- import click
7
6
  import json
8
- try:
9
- import cupy as np
10
- is_gpu = True
11
- except ImportError:
12
- is_gpu = False
13
- import numpy as np
7
+ import click
14
8
 
9
+ from .. import np
15
10
  from ..reader import binary_to_array
16
11
  from ..util import get_delimiter
17
12
 
@@ -3,13 +3,8 @@ import sys
3
3
  import logging
4
4
  from pathlib import Path
5
5
  import click
6
- try:
7
- import cupy as np
8
- is_gpu = True
9
- except ImportError:
10
- is_gpu = False
11
- import numpy as np
12
6
 
7
+ from .. import np
13
8
  from ..reader import binary_to_array, ascii_to_array
14
9
 
15
10
  _logger = logging.getLogger(__name__)
@@ -1,7 +1,8 @@
1
- from ladybug.analysisperiod import AnalysisPeriod
2
1
  from datetime import datetime
3
2
  import copy
4
3
 
4
+ from ladybug.analysisperiod import AnalysisPeriod
5
+
5
6
 
6
7
  def get_hoys(start_date, start_time, end_date, end_time, timestep, leap_year):
7
8
  """Return list of hours from start date, star hour, end date and end hour.
@@ -1,15 +1,9 @@
1
1
  """Commands to compute view factors to geometry."""
2
- import click
3
2
  import os
4
3
  import sys
5
4
  import logging
6
5
  import math
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
6
+ import click
13
7
 
14
8
  from honeybee_radiance.config import folders
15
9
 
@@ -20,6 +14,8 @@ from ladybug.futil import preparedir
20
14
 
21
15
  from honeybee_radiance_postprocess.reader import binary_to_array
22
16
 
17
+ from .. import np
18
+
23
19
  _logger = logging.getLogger(__name__)
24
20
 
25
21
 
@@ -1,11 +1,7 @@
1
1
  """Functions for NumPy data type (dtype)."""
2
2
  from typing import Tuple
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
3
+
4
+ from . import np
9
5
 
10
6
 
11
7
  def smallest_integer_dtype(array: np.ndarray) -> np.signedinteger:
@@ -1,11 +1,6 @@
1
1
  """Functions for post-processing daylight outputs into electric lighting schedules."""
2
2
  from typing import List
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
3
+ from . import np
9
4
 
10
5
 
11
6
  def array_to_dimming_fraction(
@@ -2,17 +2,12 @@
2
2
  from typing import Union
3
3
  from pathlib import Path
4
4
  import json
5
- try:
6
- import cupy as np
7
- is_gpu = True
8
- except ImportError:
9
- is_gpu = False
10
- import numpy as np
11
5
 
12
6
  from ladybug.color import Colorset
13
7
  from ladybug.datatype.fraction import Fraction
14
8
  from ladybug.legend import LegendParameters
15
9
 
10
+ from . import np
16
11
  from .results.annual_daylight import AnnualDaylight
17
12
  from .dynamic import DynamicSchedule
18
13
  from .metrics import da_array2d
@@ -1,15 +1,12 @@
1
1
  """Helper functions."""
2
2
  import json
3
3
  from pathlib import Path
4
- try:
5
- import cupy as np
6
- is_gpu = True
7
- except ImportError:
8
- is_gpu = False
9
- import numpy as np
4
+ from typing import List
10
5
 
11
6
  from honeybee.model import Model
12
7
 
8
+ from . import np, IS_CPU
9
+
13
10
 
14
11
  def model_grid_areas(model, grids_info):
15
12
  if isinstance(model, Model):
@@ -148,28 +145,51 @@ def grid_summary(
148
145
 
149
146
  arrays.append(tuple(data))
150
147
 
151
- # create structured array
152
- if is_gpu:
153
- struct_array = None
154
- else:
148
+ grid_summary_file = write_structured_array_to_file(
149
+ folder, name, arrays, dtype, fmt)
150
+
151
+ return grid_summary_file
152
+
153
+
154
+ def write_structured_array_to_file(
155
+ folder: Path, name: str, arrays: List[tuple], dtype: List[tuple],
156
+ fmt: List[str]) -> Path:
157
+ """Write structured array data to a CSV file. Uses NumPy for CPU mode and
158
+ manual formatting for CuPy mode.
159
+
160
+ Args:
161
+ folder: Path object to the output folder.
162
+ name: File name without extension.
163
+ arrays: 2D array-like data.
164
+ dtype: Structured dtype definition (list of (field_name, dtype)).
165
+ fmt: List/tuple of printf-style formats for each column.
166
+
167
+ Returns:
168
+ Path to the written CSV file.
169
+ """
170
+ if IS_CPU:
155
171
  struct_array = np.array(arrays, dtype=dtype)
172
+ else:
173
+ struct_array = None
174
+
175
+ filepath = folder.joinpath(f'{name}.csv')
156
176
 
157
177
  header = [dt[0] for dt in dtype]
158
- # write header to file
159
- with open(folder.joinpath(f'{name}.csv'), 'w') as grid_summary_file:
160
- grid_summary_file.write(','.join(header))
161
- # write structured array to grid_summary_file
162
- with open(folder.joinpath(f'{name}.csv'), 'a') as grid_summary_file:
163
- grid_summary_file.write('\n')
164
- if is_gpu:
178
+
179
+ with open(filepath, 'w') as f:
180
+ f.write(','.join(header))
181
+
182
+ with open(filepath, 'a') as f:
183
+ f.write('\n')
184
+ if IS_CPU:
185
+ np.savetxt(f, struct_array, delimiter=',', fmt=fmt)
186
+ else:
165
187
  # CuPy doesn't support structured arrays; manually format rows
166
188
  for row in arrays:
167
189
  row_str = ','.join(fmt_val % val for fmt_val, val in zip(fmt, row))
168
- grid_summary_file.write(row_str + '\n')
169
- else:
170
- np.savetxt(grid_summary_file, struct_array, delimiter=',', fmt=fmt)
190
+ f.write(row_str + '\n')
171
191
 
172
- return grid_summary_file
192
+ return filepath
173
193
 
174
194
 
175
195
  def _calculate_percentage(gr_metric_bool, grid_info, grid_area=None):
@@ -2,15 +2,10 @@
2
2
  from typing import Tuple, Union
3
3
  from collections import defaultdict
4
4
  import itertools
5
- try:
6
- import cupy as np
7
- is_gpu = True
8
- except ImportError:
9
- is_gpu = False
10
- import numpy as np
11
5
 
12
6
  from honeybee_radiance.postprocess.annual import filter_schedule_by_hours
13
7
 
8
+ from .. import np
14
9
  from ..annual import schedule_to_hoys, occupancy_schedule_8_to_6
15
10
  from ..results.annual_daylight import AnnualDaylight
16
11
  from ..util import filter_array
@@ -1,12 +1,7 @@
1
1
  """Module for dynamic LM schedules."""
2
2
  from typing import Tuple
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
9
3
 
4
+ from .. import np
10
5
  from ..results.annual_daylight import AnnualDaylight
11
6
  from ..util import filter_array
12
7
 
@@ -4,12 +4,6 @@ from pathlib import Path
4
4
  from collections import defaultdict
5
5
  import json
6
6
  import itertools
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
13
7
 
14
8
  from ladybug.analysisperiod import AnalysisPeriod
15
9
  from ladybug.datatype.generic import GenericType
@@ -24,6 +18,7 @@ from honeybee.units import conversion_factor_to_meters
24
18
  from honeybee_radiance.writer import _filter_by_pattern
25
19
  from honeybee_radiance.postprocess.annual import filter_schedule_by_hours
26
20
 
21
+ from .. import np
27
22
  from ..metrics import da_array2d, ase_array2d
28
23
  from ..annual import schedule_to_hoys, occupancy_schedule_8_to_6
29
24
  from ..results.annual_daylight import AnnualDaylight
@@ -31,8 +26,6 @@ from ..util import recursive_dict_merge, filter_array2d
31
26
  from ..dynamic import DynamicSchedule, ApertureGroupSchedule
32
27
  from .leed_schedule import shd_trans_schedule_descending, states_schedule_descending
33
28
 
34
- is_cpu = not is_gpu
35
-
36
29
 
37
30
  def _create_grid_summary(
38
31
  grid_info, sda_grid, sda_blinds_up_grid, sda_blinds_down_grid, ase_grid,
@@ -1,12 +1,7 @@
1
1
  """Module for dynamic LEED schedules."""
2
2
  from typing import Tuple
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
9
3
 
4
+ from .. import np
10
5
  from ..results.annual_daylight import AnnualDaylight
11
6
  from ..util import filter_array2d
12
7
 
@@ -1,16 +1,9 @@
1
1
  """Functions to calculate various metrics for 1D and 2D NumPy arrays."""
2
2
  from typing import Tuple, Union
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
9
3
 
4
+ from . import np, IS_CPU
10
5
  from .util import check_array_dim
11
6
 
12
- is_cpu = not is_gpu
13
-
14
7
 
15
8
  def da_array2d(
16
9
  array: np.ndarray, total_occ: int = None, threshold: float = 300) -> np.ndarray:
@@ -80,15 +73,22 @@ def cda_array2d(
80
73
  # set total_occ to number of columns in array
81
74
  total_occ = array.shape[1]
82
75
 
83
- if is_cpu:
84
- cda = np.apply_along_axis(
85
- cda_array1d, 1, array, total_occ=total_occ, threshold=threshold)
86
- else:
87
- cda = np.where(array >= threshold, 1, array / threshold).sum(axis=1) / total_occ * 100
76
+ cda = cda_array2d_wrapper(array, total_occ, threshold)
88
77
 
89
78
  return cda
90
79
 
91
80
 
81
+ def cda_array2d_wrapper(array, total_occ, threshold):
82
+ """Compute cDA for a 2D array using NumPy (CPU) or CuPy (GPU)."""
83
+ if IS_CPU:
84
+ return np.apply_along_axis(
85
+ cda_array1d, 1, array, total_occ=total_occ, threshold=threshold
86
+ )
87
+
88
+ return (np.where(array >= threshold, 1, array / threshold)
89
+ .sum(axis=1) / total_occ * 100)
90
+
91
+
92
92
  def cda_array1d(
93
93
  array: np.ndarray, total_occ: int = None,
94
94
  threshold: float = 300) -> np.float64:
@@ -133,15 +133,23 @@ def udi_array2d(
133
133
  # set total_occ to number of columns in array
134
134
  total_occ = array.shape[1]
135
135
 
136
- if is_cpu:
137
- udi = np.apply_along_axis(
138
- udi_array1d, 1, array, total_occ=total_occ, min_t=min_t, max_t=max_t)
139
- else:
140
- udi = ((array >= min_t) & (array <= max_t)).sum(axis=1) / total_occ * 100
136
+ udi = udi_array2d_wrapper(array, total_occ, min_t, max_t)
141
137
 
142
138
  return udi
143
139
 
144
140
 
141
+ def udi_array2d_wrapper(array, total_occ, min_t, max_t):
142
+ """Compute UDI for a 2D array using NumPy (CPU) or CuPy (GPU)."""
143
+ if IS_CPU:
144
+ return np.apply_along_axis(
145
+ udi_array1d, 1, array,
146
+ total_occ=total_occ, min_t=min_t, max_t=max_t
147
+ )
148
+
149
+ return (((array >= min_t) & (array <= max_t))
150
+ .sum(axis=1) / total_occ * 100)
151
+
152
+
145
153
  def udi_array1d(
146
154
  array: np.ndarray, total_occ: int = None, min_t: float = 100,
147
155
  max_t: float = 3000) -> np.float64:
@@ -186,19 +194,26 @@ def udi_lower_array2d(
186
194
  # set total_occ to number of columns in array
187
195
  total_occ = array.shape[1]
188
196
 
189
- if is_cpu:
190
- udi = np.apply_along_axis(
191
- udi_lower_array1d, 1, array, total_occ=total_occ, min_t=min_t,
192
- sun_down_occ_hours=sun_down_occ_hours)
193
- else:
194
- if min_t == 0:
195
- return np.zeros(array.shape[0], dtype=np.float32)
196
-
197
- udi = ((array < min_t).sum(axis=1) + sun_down_occ_hours) / total_occ * 100
197
+ udi = udi_lower_array2d_wrapper(array, total_occ, min_t, sun_down_occ_hours)
198
198
 
199
199
  return udi
200
200
 
201
201
 
202
+ def udi_lower_array2d_wrapper(array, total_occ, min_t, sun_down_occ_hours):
203
+ """Compute UDI lower for a 2D array using NumPy (CPU) or CuPy (GPU)."""
204
+ if IS_CPU:
205
+ return np.apply_along_axis(
206
+ udi_lower_array1d, 1, array, total_occ=total_occ, min_t=min_t,
207
+ sun_down_occ_hours=sun_down_occ_hours
208
+ )
209
+
210
+ if min_t == 0:
211
+ return np.zeros(array.shape[0], dtype=np.float32)
212
+
213
+ return (((array < min_t).sum(axis=1) + sun_down_occ_hours)
214
+ / total_occ * 100)
215
+
216
+
202
217
  def udi_lower_array1d(
203
218
  array: np.ndarray, total_occ: int = None, min_t: float = 100,
204
219
  sun_down_occ_hours: int = 0) -> np.float64:
@@ -245,15 +260,22 @@ def udi_upper_array2d(
245
260
  # set total_occ to number of columns in array
246
261
  total_occ = array.shape[1]
247
262
 
248
- if is_cpu:
249
- udi = np.apply_along_axis(
250
- udi_upper_array1d, 1, array, total_occ=total_occ, max_t=max_t)
251
- else:
252
- udi = (array > max_t).sum(axis=1) / total_occ * 100
263
+ udi = udi_upper_array2d_wrapper(array, total_occ, max_t)
253
264
 
254
265
  return udi
255
266
 
256
267
 
268
+ def udi_upper_array2d_wrapper(array, total_occ, max_t):
269
+ """Compute UDI upper for a 2D array using NumPy (CPU) or CuPy (GPU)."""
270
+ if IS_CPU:
271
+ return np.apply_along_axis(
272
+ udi_upper_array1d, 1, array,
273
+ total_occ=total_occ, max_t=max_t
274
+ )
275
+
276
+ return ((array > max_t).sum(axis=1) / total_occ * 100)
277
+
278
+
257
279
  def udi_upper_array1d(
258
280
  array: np.ndarray, total_occ: int = None,
259
281
  max_t: float = 3000) -> np.float64:
@@ -1,11 +1,5 @@
1
1
  """Post-processing reader functions."""
2
- try:
3
- import cupy as np
4
- is_gpu = True
5
- except ImportError:
6
- is_gpu = False
7
- import numpy as np
8
-
2
+ from . import np
9
3
  from .util import binary_mtx_dimension
10
4
 
11
5
 
@@ -1,12 +1,6 @@
1
1
  import json
2
2
  from pathlib import Path
3
3
  from typing import Tuple, List
4
- try:
5
- import cupy as np
6
- is_gpu = True
7
- except ImportError:
8
- is_gpu = False
9
- import numpy as np
10
4
 
11
5
  from collections import defaultdict
12
6
 
@@ -16,18 +10,17 @@ from ladybug.datatype.illuminance import Illuminance
16
10
  from ladybug.datatype.fraction import Fraction
17
11
  from ladybug.header import Header
18
12
 
13
+ from .. import np
19
14
  from ..annual import occupancy_schedule_8_to_6
20
15
  from ..metrics import da_array2d, cda_array2d, udi_array2d, udi_lower_array2d, \
21
16
  udi_upper_array2d, ase_array2d
22
- from ..util import filter_array, filter_array2d
17
+ from ..util import filter_array2d
23
18
  from ..annualdaylight import _annual_daylight_vis_metadata
24
19
  from ..electriclight import array_to_dimming_fraction
25
20
  from .. import type_hints
26
21
  from ..dynamic import DynamicSchedule, ApertureGroupSchedule
27
22
  from .results import Results
28
23
 
29
- is_cpu = not is_gpu
30
-
31
24
 
32
25
  class AnnualDaylight(Results):
33
26
  """Annual Daylight Results class.
@@ -1,14 +1,9 @@
1
1
  import json
2
2
  from pathlib import Path
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
9
3
 
10
4
  from ladybug.datatype.energyflux import EnergyFlux
11
5
 
6
+ from .. import np
12
7
  from ..metrics import (average_values_array2d, cumulative_values_array2d,
13
8
  peak_values_array2d)
14
9
  from ..util import filter_array, hoys_mask
@@ -4,12 +4,6 @@ from pathlib import Path
4
4
  from itertools import islice, cycle
5
5
  from typing import Tuple, Union, List
6
6
  import itertools
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
13
7
 
14
8
  from ladybug.analysisperiod import AnalysisPeriod
15
9
  from ladybug.datacollection import HourlyContinuousCollection
@@ -18,6 +12,7 @@ from ladybug.datatype.base import DataTypeBase
18
12
  from ladybug.dt import DateTime
19
13
  from ladybug.header import Header
20
14
 
15
+ from .. import np
21
16
  from ..annual import occupancy_schedule_8_to_6
22
17
  from ..metrics import (average_values_array2d, cumulative_values_array2d,
23
18
  peak_values_array2d)
@@ -26,8 +21,6 @@ from ..util import filter_array2d, hoys_mask, check_array_dim, \
26
21
  from .. import type_hints
27
22
  from ..dynamic import DynamicSchedule, ApertureGroupSchedule
28
23
 
29
- is_cpu = not is_gpu
30
-
31
24
 
32
25
  class _ResultsFolder(object):
33
26
  """Base class for ResultsFolder.
@@ -1,14 +1,10 @@
1
1
  """Type hints for honeybee-radiance-postprocess."""
2
2
  from typing import Tuple, List
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
9
3
 
10
4
  from ladybug.datacollection import HourlyContinuousCollection
11
5
 
6
+ from . import np
7
+
12
8
 
13
9
  annual_metric = Tuple[List[np.ndarray], List[dict]]
14
10
  annual_daylight_metrics = Tuple[
@@ -1,15 +1,9 @@
1
1
  """Post-processing utility functions."""
2
2
  from typing import Tuple
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
9
3
 
10
4
  from honeybee_radiance.writer import _filter_by_pattern
11
5
 
12
- is_cpu = not is_gpu
6
+ from . import np
13
7
 
14
8
 
15
9
  def binary_mtx_dimension(filepath: str) -> Tuple[int, int, int, int, str]:
@@ -2,7 +2,6 @@
2
2
  from typing import Tuple, Union
3
3
  from pathlib import Path
4
4
  import json
5
- import numpy as np
6
5
 
7
6
  from ladybug.analysisperiod import AnalysisPeriod
8
7
  from ladybug.datacollection import HourlyContinuousCollection
@@ -12,6 +11,7 @@ from honeybee.model import Model
12
11
  from honeybee.units import conversion_factor_to_meters
13
12
  from honeybee_radiance.writer import _filter_by_pattern
14
13
 
14
+ from .. import np
15
15
  from ..metrics import da_array2d
16
16
  from ..annual import occupancy_schedule_8_to_6
17
17
  from ..results.annual_daylight import AnnualDaylight
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: honeybee-radiance-postprocess
3
- Version: 0.4.585
3
+ Version: 0.4.587
4
4
  Summary: Postprocessing of Radiance results and matrices
5
5
  Home-page: https://github.com/ladybug-tools/honeybee-radiance-postprocess
6
6
  Author: Ladybug Tools
@@ -16,8 +16,9 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
16
16
  Classifier: Operating System :: OS Independent
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: honeybee-radiance==1.66.216
19
+ Requires-Dist: honeybee-radiance==1.66.217
20
20
  Requires-Dist: numpy<2.0.0
21
+ Requires-Dist: cupy-cuda12x==13.6.0
21
22
  Dynamic: author
22
23
  Dynamic: author-email
23
24
  Dynamic: classifier
@@ -1,5 +1,6 @@
1
1
  CODE_OF_CONDUCT.md
2
2
  CONTRIBUTING.md
3
+ CUPY.MD
3
4
  LICENSE
4
5
  MANIFEST.in
5
6
  README.md
@@ -0,0 +1,3 @@
1
+ honeybee-radiance==1.66.217
2
+ numpy<2.0.0
3
+ cupy-cuda12x==13.6.0
@@ -0,0 +1,3 @@
1
+ honeybee-radiance==1.66.217
2
+ numpy<2.0.0
3
+ cupy-cuda12x==13.6.0
@@ -1 +0,0 @@
1
- """honeybee-radiance-postprocess library."""
@@ -1,2 +0,0 @@
1
- honeybee-radiance==1.66.216
2
- numpy<2.0.0
@@ -1,2 +0,0 @@
1
- honeybee-radiance==1.66.216
2
- numpy<2.0.0