honeybee-radiance 1.66.190__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.
Potentially problematic release.
This version of honeybee-radiance might be problematic. Click here for more details.
- honeybee_radiance/__init__.py +11 -0
- honeybee_radiance/__main__.py +4 -0
- honeybee_radiance/_extend_honeybee.py +93 -0
- honeybee_radiance/cli/__init__.py +88 -0
- honeybee_radiance/cli/dc.py +400 -0
- honeybee_radiance/cli/edit.py +529 -0
- honeybee_radiance/cli/glare.py +118 -0
- honeybee_radiance/cli/grid.py +859 -0
- honeybee_radiance/cli/lib.py +458 -0
- honeybee_radiance/cli/modifier.py +133 -0
- honeybee_radiance/cli/mtx.py +226 -0
- honeybee_radiance/cli/multiphase.py +1034 -0
- honeybee_radiance/cli/octree.py +640 -0
- honeybee_radiance/cli/postprocess.py +1186 -0
- honeybee_radiance/cli/raytrace.py +219 -0
- honeybee_radiance/cli/rpict.py +125 -0
- honeybee_radiance/cli/schedule.py +56 -0
- honeybee_radiance/cli/setconfig.py +63 -0
- honeybee_radiance/cli/sky.py +545 -0
- honeybee_radiance/cli/study.py +66 -0
- honeybee_radiance/cli/sunpath.py +331 -0
- honeybee_radiance/cli/threephase.py +255 -0
- honeybee_radiance/cli/translate.py +400 -0
- honeybee_radiance/cli/util.py +121 -0
- honeybee_radiance/cli/view.py +261 -0
- honeybee_radiance/cli/viewfactor.py +347 -0
- honeybee_radiance/config.json +6 -0
- honeybee_radiance/config.py +427 -0
- honeybee_radiance/dictutil.py +50 -0
- honeybee_radiance/dynamic/__init__.py +5 -0
- honeybee_radiance/dynamic/group.py +479 -0
- honeybee_radiance/dynamic/multiphase.py +557 -0
- honeybee_radiance/dynamic/state.py +718 -0
- honeybee_radiance/dynamic/stategeo.py +352 -0
- honeybee_radiance/geometry/__init__.py +13 -0
- honeybee_radiance/geometry/bubble.py +42 -0
- honeybee_radiance/geometry/cone.py +215 -0
- honeybee_radiance/geometry/cup.py +54 -0
- honeybee_radiance/geometry/cylinder.py +197 -0
- honeybee_radiance/geometry/geometrybase.py +37 -0
- honeybee_radiance/geometry/instance.py +40 -0
- honeybee_radiance/geometry/mesh.py +38 -0
- honeybee_radiance/geometry/polygon.py +174 -0
- honeybee_radiance/geometry/ring.py +214 -0
- honeybee_radiance/geometry/source.py +182 -0
- honeybee_radiance/geometry/sphere.py +178 -0
- honeybee_radiance/geometry/tube.py +46 -0
- honeybee_radiance/lib/__init__.py +1 -0
- honeybee_radiance/lib/_loadmodifiers.py +72 -0
- honeybee_radiance/lib/_loadmodifiersets.py +69 -0
- honeybee_radiance/lib/modifiers.py +58 -0
- honeybee_radiance/lib/modifiersets.py +63 -0
- honeybee_radiance/lightpath.py +204 -0
- honeybee_radiance/lightsource/__init__.py +1 -0
- honeybee_radiance/lightsource/_gendaylit.py +479 -0
- honeybee_radiance/lightsource/dictutil.py +49 -0
- honeybee_radiance/lightsource/ground.py +160 -0
- honeybee_radiance/lightsource/sky/__init__.py +7 -0
- honeybee_radiance/lightsource/sky/_skybase.py +177 -0
- honeybee_radiance/lightsource/sky/certainirradiance.py +232 -0
- honeybee_radiance/lightsource/sky/cie.py +378 -0
- honeybee_radiance/lightsource/sky/climatebased.py +501 -0
- honeybee_radiance/lightsource/sky/hemisphere.py +160 -0
- honeybee_radiance/lightsource/sky/skydome.py +113 -0
- honeybee_radiance/lightsource/sky/skymatrix.py +163 -0
- honeybee_radiance/lightsource/sky/strutil.py +34 -0
- honeybee_radiance/lightsource/sky/sunmatrix.py +212 -0
- honeybee_radiance/lightsource/sunpath.py +247 -0
- honeybee_radiance/modifier/__init__.py +3 -0
- honeybee_radiance/modifier/material/__init__.py +30 -0
- honeybee_radiance/modifier/material/absdf.py +477 -0
- honeybee_radiance/modifier/material/antimatter.py +54 -0
- honeybee_radiance/modifier/material/ashik2.py +51 -0
- honeybee_radiance/modifier/material/brtdfunc.py +81 -0
- honeybee_radiance/modifier/material/bsdf.py +292 -0
- honeybee_radiance/modifier/material/dielectric.py +53 -0
- honeybee_radiance/modifier/material/glass.py +431 -0
- honeybee_radiance/modifier/material/glow.py +246 -0
- honeybee_radiance/modifier/material/illum.py +51 -0
- honeybee_radiance/modifier/material/interface.py +49 -0
- honeybee_radiance/modifier/material/light.py +206 -0
- honeybee_radiance/modifier/material/materialbase.py +36 -0
- honeybee_radiance/modifier/material/metal.py +167 -0
- honeybee_radiance/modifier/material/metal2.py +41 -0
- honeybee_radiance/modifier/material/metdata.py +41 -0
- honeybee_radiance/modifier/material/metfunc.py +41 -0
- honeybee_radiance/modifier/material/mirror.py +340 -0
- honeybee_radiance/modifier/material/mist.py +86 -0
- honeybee_radiance/modifier/material/plasdata.py +58 -0
- honeybee_radiance/modifier/material/plasfunc.py +59 -0
- honeybee_radiance/modifier/material/plastic.py +354 -0
- honeybee_radiance/modifier/material/plastic2.py +58 -0
- honeybee_radiance/modifier/material/prism1.py +57 -0
- honeybee_radiance/modifier/material/prism2.py +48 -0
- honeybee_radiance/modifier/material/spotlight.py +50 -0
- honeybee_radiance/modifier/material/trans.py +518 -0
- honeybee_radiance/modifier/material/trans2.py +49 -0
- honeybee_radiance/modifier/material/transdata.py +50 -0
- honeybee_radiance/modifier/material/transfunc.py +53 -0
- honeybee_radiance/modifier/mixture/__init__.py +6 -0
- honeybee_radiance/modifier/mixture/mixdata.py +49 -0
- honeybee_radiance/modifier/mixture/mixfunc.py +54 -0
- honeybee_radiance/modifier/mixture/mixpict.py +52 -0
- honeybee_radiance/modifier/mixture/mixtext.py +66 -0
- honeybee_radiance/modifier/mixture/mixturebase.py +28 -0
- honeybee_radiance/modifier/modifierbase.py +40 -0
- honeybee_radiance/modifier/pattern/__init__.py +9 -0
- honeybee_radiance/modifier/pattern/brightdata.py +49 -0
- honeybee_radiance/modifier/pattern/brightfunc.py +47 -0
- honeybee_radiance/modifier/pattern/brighttext.py +81 -0
- honeybee_radiance/modifier/pattern/colordata.py +56 -0
- honeybee_radiance/modifier/pattern/colorfunc.py +47 -0
- honeybee_radiance/modifier/pattern/colorpict.py +54 -0
- honeybee_radiance/modifier/pattern/colortext.py +73 -0
- honeybee_radiance/modifier/pattern/patternbase.py +34 -0
- honeybee_radiance/modifier/texture/__init__.py +4 -0
- honeybee_radiance/modifier/texture/texdata.py +29 -0
- honeybee_radiance/modifier/texture/texfunc.py +26 -0
- honeybee_radiance/modifier/texture/texturebase.py +27 -0
- honeybee_radiance/modifierset.py +1091 -0
- honeybee_radiance/mutil.py +60 -0
- honeybee_radiance/postprocess/__init__.py +1 -0
- honeybee_radiance/postprocess/annual.py +108 -0
- honeybee_radiance/postprocess/annualdaylight.py +425 -0
- honeybee_radiance/postprocess/annualglare.py +201 -0
- honeybee_radiance/postprocess/annualirradiance.py +187 -0
- honeybee_radiance/postprocess/electriclight.py +119 -0
- honeybee_radiance/postprocess/en17037.py +261 -0
- honeybee_radiance/postprocess/leed.py +304 -0
- honeybee_radiance/postprocess/solartracking.py +90 -0
- honeybee_radiance/primitive.py +554 -0
- honeybee_radiance/properties/__init__.py +1 -0
- honeybee_radiance/properties/_base.py +390 -0
- honeybee_radiance/properties/aperture.py +197 -0
- honeybee_radiance/properties/door.py +198 -0
- honeybee_radiance/properties/face.py +123 -0
- honeybee_radiance/properties/model.py +1291 -0
- honeybee_radiance/properties/room.py +490 -0
- honeybee_radiance/properties/shade.py +186 -0
- honeybee_radiance/properties/shademesh.py +116 -0
- honeybee_radiance/putil.py +44 -0
- honeybee_radiance/reader.py +214 -0
- honeybee_radiance/sensor.py +166 -0
- honeybee_radiance/sensorgrid.py +1008 -0
- honeybee_radiance/view.py +1101 -0
- honeybee_radiance/writer.py +951 -0
- honeybee_radiance-1.66.190.dist-info/METADATA +89 -0
- honeybee_radiance-1.66.190.dist-info/RECORD +152 -0
- honeybee_radiance-1.66.190.dist-info/WHEEL +5 -0
- honeybee_radiance-1.66.190.dist-info/entry_points.txt +2 -0
- honeybee_radiance-1.66.190.dist-info/licenses/LICENSE +661 -0
- honeybee_radiance-1.66.190.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
"""Door Radiance Properties."""
|
|
3
|
+
from ._base import _DynamicRadianceProperties
|
|
4
|
+
from ..modifier import Modifier
|
|
5
|
+
from ..dynamic.state import RadianceSubFaceState
|
|
6
|
+
from ..lib.modifiers import black
|
|
7
|
+
from ..lib.modifiersets import generic_modifier_set_visible
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DoorRadianceProperties(_DynamicRadianceProperties):
|
|
11
|
+
"""Radiance Properties for Honeybee Door.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
host: A honeybee_core Door object that hosts these properties.
|
|
16
|
+
modifier: A Honeybee Radiance Modifier object for the door. If None,
|
|
17
|
+
it will be set by the parent Room ModifierSet or the Honeybee
|
|
18
|
+
default generic ModifierSet.
|
|
19
|
+
modifier_blk: A Honeybee Radiance Modifier object to be used for this
|
|
20
|
+
door in direct solar simulations and in isolation studies (assessing
|
|
21
|
+
the contribution of individual Doors). If None, this will be
|
|
22
|
+
a completely black material.
|
|
23
|
+
dynamic_group_identifier: An optional string to note the dynamic group
|
|
24
|
+
to which the Door is a part of. Doors sharing the same
|
|
25
|
+
dynamic_group_identifier will have their states change in unison.
|
|
26
|
+
If None, the Door is assumed to be static.
|
|
27
|
+
|
|
28
|
+
Properties:
|
|
29
|
+
* host
|
|
30
|
+
* modifier
|
|
31
|
+
* modifier_blk
|
|
32
|
+
* dynamic_group_identifier
|
|
33
|
+
* states
|
|
34
|
+
* state_count
|
|
35
|
+
* is_opaque
|
|
36
|
+
* is_modifier_set_on_object
|
|
37
|
+
* is_blk_overridden
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
__slots__ = ()
|
|
41
|
+
|
|
42
|
+
def __init__(self, host, modifier=None, modifier_blk=None,
|
|
43
|
+
dynamic_group_identifier=None):
|
|
44
|
+
"""Initialize Door radiance properties."""
|
|
45
|
+
_DynamicRadianceProperties.__init__(
|
|
46
|
+
self, host, modifier, modifier_blk, dynamic_group_identifier)
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def modifier(self):
|
|
50
|
+
"""Get or set the Door modifier.
|
|
51
|
+
|
|
52
|
+
If the modifier is not set on the door-level, then it will be assigned
|
|
53
|
+
based on the ModifierSet assigned to the parent Room. If there is no
|
|
54
|
+
parent Room or the parent Room's ModifierSet has no modifier for
|
|
55
|
+
the Door type and boundary_condition, it will be assigned using the
|
|
56
|
+
honeybee default generic ModifierSet.
|
|
57
|
+
"""
|
|
58
|
+
if self._modifier: # set by user
|
|
59
|
+
return self._modifier
|
|
60
|
+
elif self._host.has_parent and self._host.parent.has_parent: # set by room
|
|
61
|
+
constr_set = self._host.parent.parent.properties.radiance.modifier_set
|
|
62
|
+
return constr_set.get_door_modifier(
|
|
63
|
+
self._host.boundary_condition.name, self._host.is_glass,
|
|
64
|
+
self._host.parent.type.name)
|
|
65
|
+
elif self._host.has_parent: # generic but influenced by parent door
|
|
66
|
+
return generic_modifier_set_visible.get_door_modifier(
|
|
67
|
+
self._host.boundary_condition.name, self._host.is_glass,
|
|
68
|
+
self._host.parent.type.name)
|
|
69
|
+
else:
|
|
70
|
+
return generic_modifier_set_visible.get_door_modifier(
|
|
71
|
+
self._host.boundary_condition.name, self._host.is_glass, 'Wall')
|
|
72
|
+
|
|
73
|
+
@modifier.setter
|
|
74
|
+
def modifier(self, value):
|
|
75
|
+
if value is not None:
|
|
76
|
+
assert isinstance(value, Modifier), \
|
|
77
|
+
'Expected Radiance Modifier for door. Got {}'.format(type(value))
|
|
78
|
+
value.lock() # lock editing in case modifier has multiple references
|
|
79
|
+
self._modifier = value
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def modifier_blk(self):
|
|
83
|
+
"""Get or set a modifier to be used in direct solar and in isolation studies.
|
|
84
|
+
|
|
85
|
+
If None, this will be a completely black material.
|
|
86
|
+
"""
|
|
87
|
+
if self._modifier_blk: # set by user
|
|
88
|
+
return self._modifier_blk
|
|
89
|
+
return black
|
|
90
|
+
|
|
91
|
+
@modifier_blk.setter
|
|
92
|
+
def modifier_blk(self, value):
|
|
93
|
+
if value is not None:
|
|
94
|
+
assert isinstance(value, Modifier), \
|
|
95
|
+
'Expected Radiance Modifier for door. Got {}'.format(type(value))
|
|
96
|
+
value.lock() # lock editing in case modifier has multiple references
|
|
97
|
+
self._modifier_blk = value
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def from_dict(cls, data, host):
|
|
101
|
+
"""Create DoorRadianceProperties from a dictionary.
|
|
102
|
+
|
|
103
|
+
Note that the dictionary must be a non-abridged version for this
|
|
104
|
+
classmethod to work.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
data: A dictionary representation of DoorRadianceProperties with the
|
|
108
|
+
format below.
|
|
109
|
+
host: A Door object that hosts these properties.
|
|
110
|
+
|
|
111
|
+
.. code-block:: python
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
'type': 'DoorRadianceProperties',
|
|
115
|
+
'modifier': {}, # A Honeybee Radiance Modifier dictionary
|
|
116
|
+
'modifier_blk': {}, # A Honeybee Radiance Modifier dictionary
|
|
117
|
+
'dynamic_group_identifier': str, # An optional dynamic group identifier
|
|
118
|
+
'states': [] # An optional list of states
|
|
119
|
+
}
|
|
120
|
+
"""
|
|
121
|
+
assert data['type'] == 'DoorRadianceProperties', \
|
|
122
|
+
'Expected DoorRadianceProperties. Got {}.'.format(data['type'])
|
|
123
|
+
new_prop = cls(host)
|
|
124
|
+
new_prop = cls._restore_modifiers_from_dict(new_prop, data)
|
|
125
|
+
return cls._restore_states_from_dict(new_prop, data)
|
|
126
|
+
|
|
127
|
+
def apply_properties_from_dict(self, abridged_data, modifiers):
|
|
128
|
+
"""Apply properties from a DoorRadiancePropertiesAbridged dictionary.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
abridged_data: A DoorRadiancePropertiesAbridged dictionary (typically
|
|
132
|
+
coming from a Model) with the format below.
|
|
133
|
+
modifiers: A dictionary of modifiers with modifier identifiers as keys,
|
|
134
|
+
which will be used to re-assign modifiers.
|
|
135
|
+
|
|
136
|
+
.. code-block:: python
|
|
137
|
+
|
|
138
|
+
{
|
|
139
|
+
'type': 'DoorRadiancePropertiesAbridged',
|
|
140
|
+
'modifier': str, # A Honeybee Radiance Modifier identifier
|
|
141
|
+
'modifier_blk': str, # A Honeybee Radiance Modifier identifier
|
|
142
|
+
'dynamic_group_identifier': str, # An optional dynamic group identifier
|
|
143
|
+
'states': [] # An optional list of states
|
|
144
|
+
}
|
|
145
|
+
"""
|
|
146
|
+
self._apply_modifiers_from_dict(abridged_data, modifiers)
|
|
147
|
+
self._apply_states_from_dict(abridged_data, modifiers)
|
|
148
|
+
|
|
149
|
+
def to_dict(self, abridged=False):
|
|
150
|
+
"""Return radiance properties as a dictionary.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
abridged: Boolean to note whether the full dictionary describing the
|
|
154
|
+
object should be returned (False) or just an abridged version (True).
|
|
155
|
+
Default: False.
|
|
156
|
+
"""
|
|
157
|
+
base = {'radiance': {}}
|
|
158
|
+
base['radiance']['type'] = 'DoorRadianceProperties' if not \
|
|
159
|
+
abridged else 'DoorRadiancePropertiesAbridged'
|
|
160
|
+
self._add_modifiers_to_dict(base, abridged)
|
|
161
|
+
return self._add_states_to_dict(base, abridged)
|
|
162
|
+
|
|
163
|
+
def _check_state(self, obj):
|
|
164
|
+
assert isinstance(obj, RadianceSubFaceState), \
|
|
165
|
+
'Expected RadianceSubFaceState. Got {}.'.format(type(obj))
|
|
166
|
+
assert obj.parent is None, \
|
|
167
|
+
'RadianceSubFaceState cannot already have a parent object.'
|
|
168
|
+
obj._parent = self.host
|
|
169
|
+
return obj
|
|
170
|
+
|
|
171
|
+
def _apply_states_from_dict(self, abridged_data, modifiers):
|
|
172
|
+
"""Apply statess from an Abridged dictionary.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
abridged_data: An Abridged dictionary (typically coming from a Model).
|
|
176
|
+
modifiers: A dictionary of modifiers with modifier identifiers as keys,
|
|
177
|
+
which will be used to re-assign modifiers.
|
|
178
|
+
"""
|
|
179
|
+
if 'dynamic_group_identifier' in abridged_data and \
|
|
180
|
+
abridged_data['dynamic_group_identifier'] is not None:
|
|
181
|
+
self.dynamic_group_identifier = abridged_data['dynamic_group_identifier']
|
|
182
|
+
if 'states' in abridged_data and abridged_data['states'] is not None:
|
|
183
|
+
self.states = [RadianceSubFaceState.from_dict_abridged(st, modifiers)
|
|
184
|
+
for st in abridged_data['states']]
|
|
185
|
+
|
|
186
|
+
@staticmethod
|
|
187
|
+
def _restore_states_from_dict(new_prop, data):
|
|
188
|
+
"""Restore states from a data dictionary to a new properties object."""
|
|
189
|
+
if 'dynamic_group_identifier' in data and \
|
|
190
|
+
data['dynamic_group_identifier'] is not None:
|
|
191
|
+
new_prop.dynamic_group_identifier = data['dynamic_group_identifier']
|
|
192
|
+
if 'states' in data and data['states'] is not None:
|
|
193
|
+
new_prop.states = [RadianceSubFaceState.from_dict(shd)
|
|
194
|
+
for shd in data['states']]
|
|
195
|
+
return new_prop
|
|
196
|
+
|
|
197
|
+
def __repr__(self):
|
|
198
|
+
return 'Door Radiance Properties: [host: {}]'.format(self.host.display_name)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
"""Face Radiance Properties."""
|
|
3
|
+
from ._base import _RadianceProperties
|
|
4
|
+
from ..modifier import Modifier
|
|
5
|
+
from ..lib.modifiersets import generic_modifier_set_visible
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FaceRadianceProperties(_RadianceProperties):
|
|
9
|
+
"""Radiance Properties for Honeybee Face.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
host: A honeybee_core Face object that hosts these properties.
|
|
13
|
+
modifier: A Honeybee Radiance Modifier object for the face. If None,
|
|
14
|
+
it will be set by the parent Room ModifierSet or the Honeybee
|
|
15
|
+
default generic ModifierSet.
|
|
16
|
+
modifier_blk: A Honeybee Radiance Modifier object to be used for this
|
|
17
|
+
face in direct solar simulations and in isolation studies (assessing
|
|
18
|
+
the contribution of individual Apertures). If None, this will be
|
|
19
|
+
a completely black material if the Face's modifier is opaque and
|
|
20
|
+
will be equal to the modifier if the Face's modifier is non-opaque.
|
|
21
|
+
|
|
22
|
+
Properties:
|
|
23
|
+
* host
|
|
24
|
+
* modifier
|
|
25
|
+
* modifier_blk
|
|
26
|
+
* is_opaque
|
|
27
|
+
* is_modifier_set_on_object
|
|
28
|
+
* is_blk_overridden
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
__slots__ = ()
|
|
32
|
+
|
|
33
|
+
def __init__(self, host, modifier=None, modifier_blk=None):
|
|
34
|
+
"""Initialize Face radiance properties."""
|
|
35
|
+
_RadianceProperties.__init__(self, host, modifier, modifier_blk)
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def modifier(self):
|
|
39
|
+
"""Get or set the Face modifier.
|
|
40
|
+
|
|
41
|
+
If the modifier is not set on the face-level, then it will be assigned
|
|
42
|
+
based on the ModifierSet assigned to the parent Room. If there is no
|
|
43
|
+
parent Room or the parent Room's ModifierSet has no modifier for
|
|
44
|
+
the Face type and boundary_condition, it will be assigned using the
|
|
45
|
+
honeybee default generic ModifierSet.
|
|
46
|
+
"""
|
|
47
|
+
if self._modifier: # set by user
|
|
48
|
+
return self._modifier
|
|
49
|
+
elif self._host.has_parent: # set by parent room
|
|
50
|
+
modifier_set = self._host.parent.properties.radiance.modifier_set
|
|
51
|
+
return modifier_set.get_face_modifier(
|
|
52
|
+
self._host.type.name, self._host.boundary_condition.name)
|
|
53
|
+
else:
|
|
54
|
+
return generic_modifier_set_visible.get_face_modifier(
|
|
55
|
+
self._host.type.name, self._host.boundary_condition.name)
|
|
56
|
+
|
|
57
|
+
@modifier.setter
|
|
58
|
+
def modifier(self, value):
|
|
59
|
+
if value is not None:
|
|
60
|
+
assert isinstance(value, Modifier), \
|
|
61
|
+
'Expected Radiance Modifier for face. Got {}'.format(type(value))
|
|
62
|
+
value.lock() # lock editing in case modifier has multiple references
|
|
63
|
+
self._modifier = value
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_dict(cls, data, host):
|
|
67
|
+
"""Create FaceRadianceProperties from a dictionary.
|
|
68
|
+
|
|
69
|
+
Note that the dictionary must be a non-abridged version for this
|
|
70
|
+
classmethod to work.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
data: A dictionary representation of FaceRadianceProperties with the
|
|
74
|
+
format below.
|
|
75
|
+
host: A Face object that hosts these properties.
|
|
76
|
+
|
|
77
|
+
.. code-block:: python
|
|
78
|
+
|
|
79
|
+
{
|
|
80
|
+
'type': 'FaceRadianceProperties',
|
|
81
|
+
'modifier': {}, # A Honeybee Radiance Modifier dictionary
|
|
82
|
+
'modifier_blk': {} # A Honeybee Radiance Modifier dictionary
|
|
83
|
+
}
|
|
84
|
+
"""
|
|
85
|
+
assert data['type'] == 'FaceRadianceProperties', \
|
|
86
|
+
'Expected FaceRadianceProperties. Got {}.'.format(data['type'])
|
|
87
|
+
new_prop = cls(host)
|
|
88
|
+
return cls._restore_modifiers_from_dict(new_prop, data)
|
|
89
|
+
|
|
90
|
+
def apply_properties_from_dict(self, abridged_data, modifiers):
|
|
91
|
+
"""Apply properties from a FaceRadiancePropertiesAbridged dictionary.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
abridged_data: A FaceRadiancePropertiesAbridged dictionary (typically
|
|
95
|
+
coming from a Model) with the format below.
|
|
96
|
+
modifiers: A dictionary of modifiers with modifier identifiers as keys,
|
|
97
|
+
which will be used to re-assign modifiers.
|
|
98
|
+
|
|
99
|
+
.. code-block:: python
|
|
100
|
+
|
|
101
|
+
{
|
|
102
|
+
'type': 'FaceRadiancePropertiesAbridged',
|
|
103
|
+
'modifier': str, # A Honeybee Radiance Modifier identifier
|
|
104
|
+
'modifier_blk': str # A Honeybee Radiance Modifier identifier
|
|
105
|
+
}
|
|
106
|
+
"""
|
|
107
|
+
self._apply_modifiers_from_dict(abridged_data, modifiers)
|
|
108
|
+
|
|
109
|
+
def to_dict(self, abridged=False):
|
|
110
|
+
"""Return radiance properties as a dictionary.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
abridged: Boolean to note whether the full dictionary describing the
|
|
114
|
+
object should be returned (False) or just an abridged version (True).
|
|
115
|
+
Default: False.
|
|
116
|
+
"""
|
|
117
|
+
base = {'radiance': {}}
|
|
118
|
+
base['radiance']['type'] = 'FaceRadianceProperties' if not \
|
|
119
|
+
abridged else 'FaceRadiancePropertiesAbridged'
|
|
120
|
+
return self._add_modifiers_to_dict(base, abridged)
|
|
121
|
+
|
|
122
|
+
def __repr__(self):
|
|
123
|
+
return 'Face Radiance Properties: [host: {}]'.format(self.host.display_name)
|