honeybee-radiance-postprocess 0.4.414__py2.py3-none-any.whl → 0.4.416__py2.py3-none-any.whl

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.
@@ -84,6 +84,7 @@ def rgb_to_illuminance(
84
84
  # save direct sunlight illuminance
85
85
  direct_output = Path(output_folder, direct_name)
86
86
  direct_output.parent.mkdir(parents=True, exist_ok=True)
87
+
87
88
  np.save(direct_output, direct_sunlight_illuminance)
88
89
 
89
90
  except Exception:
@@ -0,0 +1,97 @@
1
+ """Functions for NumPy data type (dtype)."""
2
+ from typing import Tuple
3
+ import numpy as np
4
+
5
+
6
+ def smallest_integer_dtype(array: np.ndarray) -> np.signedinteger:
7
+ """Return the smallest possible integer dtype.
8
+
9
+ Args:
10
+ array: NumPy array.
11
+
12
+ Returns:
13
+ A NumPy integer dtype.
14
+ """
15
+ if np.all(array >= np.iinfo(np.int8).min) and \
16
+ np.all(array <= np.iinfo(np.int8).max):
17
+ return np.int8
18
+ elif np.all(array >= np.iinfo(np.int16).min) and \
19
+ np.all(array <= np.iinfo(np.int16).max):
20
+ return np.int16
21
+ elif np.all(array >= np.iinfo(np.int32).min) and \
22
+ np.all(array <= np.iinfo(np.int32).max):
23
+ return np.int32
24
+ elif np.all(array >= np.iinfo(np.int64).min) and \
25
+ np.all(array <= np.iinfo(np.int64).max):
26
+ return np.int64
27
+
28
+
29
+ def smallest_float_dtype(array: np.ndarray, rtol: float = 1e-5,
30
+ atol: float = 1e-5) -> np.floating:
31
+ """Return the smallest possible float dtype.
32
+
33
+ The allclose function is used to check if a certain floating-point precision
34
+ can be used without losing accuracy.
35
+
36
+ Args:
37
+ array: NumPy array.
38
+ rtol: The relative tolerance parameter for `np.allclose`. The default
39
+ is 1e-5.
40
+ atol: The absolute tolerance parameter for `np.allclose`. The default
41
+ is 1e-5.
42
+
43
+ Returns:
44
+ A NumPy floating dtype.
45
+ """
46
+ if np.all((array >= np.finfo(np.float16).min) & \
47
+ (array <= np.finfo(np.float16).max)):
48
+ if np.allclose(array, array.astype(np.float16), rtol=rtol, atol=atol):
49
+ return np.float16
50
+ if np.all((array >= np.finfo(np.float32).min) & \
51
+ (array <= np.finfo(np.float32).max)):
52
+ if np.allclose(array, array.astype(np.float32), rtol=rtol, atol=atol):
53
+ return np.float32
54
+ if np.all((array >= np.finfo(np.float64).min) & \
55
+ (array <= np.finfo(np.float64).max)):
56
+ if np.allclose(array, array.astype(np.float64), rtol=rtol, atol=atol):
57
+ return np.float64
58
+
59
+
60
+ def smallest_dtype(array: np.ndarray, rtol: float = 1e-5, atol: float = 1e-5
61
+ ) -> Tuple[np.signedinteger, np.floating]:
62
+ """Return the smallest possible dtype.
63
+
64
+ Args:
65
+ array: NumPy array.
66
+ rtol: The relative tolerance parameter for `np.allclose`. The default
67
+ is 1e-5. This is also used if the dtype of the array is np.floating.
68
+ atol: The absolute tolerance parameter for `np.allclose`. The default
69
+ is 1e-5. This is also used if the dtype of the array is np.floating.
70
+
71
+ Returns:
72
+ A NumPy dtype.
73
+ """
74
+ if np.issubdtype(array.dtype, np.integer):
75
+ return smallest_integer_dtype(array)
76
+ elif np.issubdtype(array.dtype, np.floating):
77
+ return smallest_float_dtype(array, rtol=rtol, atol=atol)
78
+ else:
79
+ raise TypeError(f'Expected integer or floating dtype. Got {array.dtype}')
80
+
81
+
82
+ def set_smallest_dtype(array: np.ndarray, rtol: float = 1e-5,
83
+ atol: float = 1e-5) -> np.ndarray:
84
+ """Return a NumPy array with the smallest possible dtype.
85
+
86
+ Args:
87
+ array: NumPy array.
88
+ rtol: The relative tolerance parameter for `np.allclose`. The default
89
+ is 1e-5. This is also used if the dtype of the array is np.floating.
90
+ atol: The absolute tolerance parameter for `np.allclose`. The default
91
+ is 1e-5. This is also used if the dtype of the array is np.floating.
92
+
93
+ Returns:
94
+ A new NumPy array with a smaller dtype.
95
+ """
96
+ dtype = smallest_dtype(array, rtol=rtol, atol=atol)
97
+ return array.astype(dtype)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: honeybee-radiance-postprocess
3
- Version: 0.4.414
3
+ Version: 0.4.416
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
@@ -13,7 +13,7 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
13
13
  Classifier: Operating System :: OS Independent
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
- Requires-Dist: honeybee-radiance (==1.66.92)
16
+ Requires-Dist: honeybee-radiance (==1.66.93)
17
17
  Requires-Dist: numpy (>=1.21.6)
18
18
 
19
19
  [![Build Status](https://github.com/ladybug-tools/honeybee-radiance-postprocess/actions/workflows/ci.yaml/badge.svg)](https://github.com/ladybug-tools/honeybee-radiance-postprocess/actions)
@@ -3,6 +3,7 @@ honeybee_radiance_postprocess/__main__.py,sha256=-glg9xAgYK3-Pm5Kx_8cMUeaqUj62Za
3
3
  honeybee_radiance_postprocess/annual.py,sha256=60PsvB_MuQqysYXrSA49jR0T16Im6gFltvd-KnuwPJc,2255
4
4
  honeybee_radiance_postprocess/annualdaylight.py,sha256=7pBgSVWhoemtkVhMIVe2QL27HPlJM1WJh2Y1CFJ4s9A,11258
5
5
  honeybee_radiance_postprocess/annualirradiance.py,sha256=1ZBUizL95S4uWfLh5B6Hwbu893LsNEyUuKz8dQsNe1M,1304
6
+ honeybee_radiance_postprocess/data_type.py,sha256=jbtOYr-Wb6xfF4kJKvfqEXXPXkN0grLE8AbFK4JZ5JM,3652
6
7
  honeybee_radiance_postprocess/dynamic.py,sha256=RPJh2SsjASYJCsG5QRkazVCvzWjzMxm9eeuinb3O8QA,9226
7
8
  honeybee_radiance_postprocess/electriclight.py,sha256=E7uhq7-YtZ02F9a1FbEdrXnxmYJNOFnfLF0Yw3JLQ-g,732
8
9
  honeybee_radiance_postprocess/en17037.py,sha256=5c5ahfzad12FqMwBL7c0sLOKHzLKSTXtlYFfaNhzA3w,10848
@@ -21,15 +22,15 @@ honeybee_radiance_postprocess/cli/mtxop.py,sha256=UZJnjNpPjDmShy1-Mxos4H2vTUqk_y
21
22
  honeybee_radiance_postprocess/cli/postprocess.py,sha256=CnUsIE3fWUZWLBeIjSW_wte9ptKKx-oaNDBGo63YHF4,39202
22
23
  honeybee_radiance_postprocess/cli/schedule.py,sha256=6uIy98Co4zm-ZRcELo4Lfx_aN3lNiqPe-BSimXwt1F8,3877
23
24
  honeybee_radiance_postprocess/cli/translate.py,sha256=18zkcGeRZALJ5Z82NEB3XZ-iEX2cHyneobGWV-IXWE0,6789
24
- honeybee_radiance_postprocess/cli/two_phase.py,sha256=1nZF4jyZ_C7CAfiHCz1UUOEwDaB4yOXr9ga0HIrhOB0,7033
25
+ honeybee_radiance_postprocess/cli/two_phase.py,sha256=xA6ayPv26DM5fuMkLhBMYGklf_j5ymowmncwJGXRgo8,7034
25
26
  honeybee_radiance_postprocess/cli/util.py,sha256=Be9cGmYhcV2W37ma6SgQPCWCpWLLLlroxRYN_l58kY0,4077
26
27
  honeybee_radiance_postprocess/results/__init__.py,sha256=1agBQbfT4Tf8KqSZzlfKYX8MeZryY4jJ1KB4HWqaDDk,182
27
28
  honeybee_radiance_postprocess/results/annual_daylight.py,sha256=ohysFt4OWlWUn_IvM6pjmiQcRTq_x5b998Iv0pw8AEQ,34964
28
29
  honeybee_radiance_postprocess/results/annual_irradiance.py,sha256=5zwrr4MNeHUebbSRpSBbscPOZUs2AHmYCQfIIbdYImY,8298
29
30
  honeybee_radiance_postprocess/results/results.py,sha256=GwyjIYljaCShx1b6NlYUBcU_gHhckmLcCMNrQ6HVDdE,53507
30
- honeybee_radiance_postprocess-0.4.414.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
31
- honeybee_radiance_postprocess-0.4.414.dist-info/METADATA,sha256=zouTJAppddFtk6QkAB9g4uVjNFH1U7emjMdv9B7_wk0,2245
32
- honeybee_radiance_postprocess-0.4.414.dist-info/WHEEL,sha256=unfA4MOaH0icIyIA5oH6E2sn2Hq5zKtLlHsWapZGwes,110
33
- honeybee_radiance_postprocess-0.4.414.dist-info/entry_points.txt,sha256=gFtVPx6UItXt27GfEZZO00eOZChJJEL6JwGSAB_O3rs,96
34
- honeybee_radiance_postprocess-0.4.414.dist-info/top_level.txt,sha256=4-sFbzy7ewP2EDqJV3jeFlAFx7SuxtoBBELWaKAnLdA,30
35
- honeybee_radiance_postprocess-0.4.414.dist-info/RECORD,,
31
+ honeybee_radiance_postprocess-0.4.416.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
32
+ honeybee_radiance_postprocess-0.4.416.dist-info/METADATA,sha256=SwBB3ghQY0fMC5Z5QVeIkfuxzI8v2hKvmGPa1s2u2BI,2245
33
+ honeybee_radiance_postprocess-0.4.416.dist-info/WHEEL,sha256=unfA4MOaH0icIyIA5oH6E2sn2Hq5zKtLlHsWapZGwes,110
34
+ honeybee_radiance_postprocess-0.4.416.dist-info/entry_points.txt,sha256=gFtVPx6UItXt27GfEZZO00eOZChJJEL6JwGSAB_O3rs,96
35
+ honeybee_radiance_postprocess-0.4.416.dist-info/top_level.txt,sha256=4-sFbzy7ewP2EDqJV3jeFlAFx7SuxtoBBELWaKAnLdA,30
36
+ honeybee_radiance_postprocess-0.4.416.dist-info/RECORD,,