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,51 @@
|
|
|
1
|
+
"""Radiance Illum Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Illum
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Illum(Material):
|
|
10
|
+
"""Radiance Illum Material.
|
|
11
|
+
|
|
12
|
+
Illum is used for secondary light sources with broad distributions. A secondary light
|
|
13
|
+
source is treated like any other light source, except when viewed directly. It then
|
|
14
|
+
acts like it is made of a different material (indicated by the string argument), or
|
|
15
|
+
becomes invisible (if no string argument is given, or the argument is "void").
|
|
16
|
+
Secondary sources are useful when modeling windows or brightly illuminated surfaces.
|
|
17
|
+
|
|
18
|
+
.. code-block:: shell
|
|
19
|
+
|
|
20
|
+
mod illum id
|
|
21
|
+
1 material
|
|
22
|
+
0
|
|
23
|
+
3 red green blue
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
27
|
+
or special characters. This will be used to identify the object across
|
|
28
|
+
a model and in the exported Radiance files.
|
|
29
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
30
|
+
(Default: None).
|
|
31
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
32
|
+
refer to a line number in the radiance primitive definitions and the
|
|
33
|
+
values in each array correspond to values occurring within each line.
|
|
34
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
35
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
36
|
+
argument is only useful for defining advanced primitives that are
|
|
37
|
+
defined based on other primitives. (Default: []).
|
|
38
|
+
|
|
39
|
+
Properties:
|
|
40
|
+
* identifier
|
|
41
|
+
* display_name
|
|
42
|
+
* values
|
|
43
|
+
* modifier
|
|
44
|
+
* dependencies
|
|
45
|
+
* is_modifier
|
|
46
|
+
* is_material
|
|
47
|
+
* is_opaque
|
|
48
|
+
"""
|
|
49
|
+
__slots__ = ()
|
|
50
|
+
|
|
51
|
+
pass
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Radiance Interface Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Interface
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Interface(Material):
|
|
10
|
+
"""Radiance Interface Material.
|
|
11
|
+
|
|
12
|
+
An interface is a boundary between two dielectrics. The first transmission
|
|
13
|
+
coefficient and refractive index are for the inside; the second ones are for the
|
|
14
|
+
outside. Ordinary dielectrics are surrounded by a vacuum (1 1 1 1).
|
|
15
|
+
|
|
16
|
+
.. code-block:: shell
|
|
17
|
+
|
|
18
|
+
mod interface id
|
|
19
|
+
0
|
|
20
|
+
0
|
|
21
|
+
8 rtn1 gtn1 btn1 n1 rtn2 gtn2 btn2 n2
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
25
|
+
or special characters. This will be used to identify the object across
|
|
26
|
+
a model and in the exported Radiance files.
|
|
27
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
28
|
+
(Default: None).
|
|
29
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
30
|
+
refer to a line number in the radiance primitive definitions and the
|
|
31
|
+
values in each array correspond to values occurring within each line.
|
|
32
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
33
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
34
|
+
argument is only useful for defining advanced primitives that are
|
|
35
|
+
defined based on other primitives. (Default: []).
|
|
36
|
+
|
|
37
|
+
Properties:
|
|
38
|
+
* identifier
|
|
39
|
+
* display_name
|
|
40
|
+
* values
|
|
41
|
+
* modifier
|
|
42
|
+
* dependencies
|
|
43
|
+
* is_modifier
|
|
44
|
+
* is_material
|
|
45
|
+
* is_opaque
|
|
46
|
+
"""
|
|
47
|
+
__slots__ = ()
|
|
48
|
+
|
|
49
|
+
pass
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"""Radiance Light Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Light
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .materialbase import Material
|
|
7
|
+
import honeybee.typing as typing
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Light(Material):
|
|
11
|
+
"""Radiance Light material.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
15
|
+
or special characters. This will be used to identify the object across
|
|
16
|
+
a model and in the exported Radiance files.
|
|
17
|
+
r_emittance: A positive value for the Red channel of the light (Default: 0).
|
|
18
|
+
g_emittance: A positive value for the Green channel of the light (Default: 0).
|
|
19
|
+
b_emittance: A positive value for the Blue channel of the light (Default: 0).
|
|
20
|
+
modifier: Material modifier. (Default: None).
|
|
21
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
22
|
+
argument is only useful for defining advanced primitives where the
|
|
23
|
+
primitive is defined based on other primitives. (Default: [])
|
|
24
|
+
|
|
25
|
+
Properties:
|
|
26
|
+
* identifier
|
|
27
|
+
* display_name
|
|
28
|
+
* r_emittance
|
|
29
|
+
* g_emittance
|
|
30
|
+
* b_emittance
|
|
31
|
+
* values
|
|
32
|
+
* modifier
|
|
33
|
+
* dependencies
|
|
34
|
+
* is_modifier
|
|
35
|
+
* is_material
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
__slots__ = ('_r_emittance', '_g_emittance', '_b_emittance')
|
|
39
|
+
|
|
40
|
+
def __init__(self, identifier, r_emittance=0, g_emittance=0, b_emittance=0,
|
|
41
|
+
modifier=None, dependencies=None):
|
|
42
|
+
"""Radiance Light material."""
|
|
43
|
+
Material.__init__(self, identifier, modifier=modifier,
|
|
44
|
+
dependencies=dependencies)
|
|
45
|
+
self.r_emittance = r_emittance
|
|
46
|
+
self.g_emittance = g_emittance
|
|
47
|
+
self.b_emittance = b_emittance
|
|
48
|
+
self._update_values()
|
|
49
|
+
|
|
50
|
+
def _update_values(self):
|
|
51
|
+
"update value dictionaries."
|
|
52
|
+
self._values[2] = [self.r_emittance, self.g_emittance, self.b_emittance]
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def r_emittance(self):
|
|
56
|
+
"""A positive value for the Red channel of the light.
|
|
57
|
+
|
|
58
|
+
The value must be positive (Default: 0).
|
|
59
|
+
"""
|
|
60
|
+
return self._r_emittance
|
|
61
|
+
|
|
62
|
+
@r_emittance.setter
|
|
63
|
+
def r_emittance(self, value):
|
|
64
|
+
self._r_emittance = typing.float_positive(value)
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def g_emittance(self):
|
|
68
|
+
"""A positive value for the Green channel of the light.
|
|
69
|
+
|
|
70
|
+
The value must be positive (Default: 0).
|
|
71
|
+
"""
|
|
72
|
+
return self._g_emittance
|
|
73
|
+
|
|
74
|
+
@g_emittance.setter
|
|
75
|
+
def g_emittance(self, value):
|
|
76
|
+
self._g_emittance = typing.float_positive(value)
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def b_emittance(self):
|
|
80
|
+
"""A positive value for the Blue channel of the light.
|
|
81
|
+
|
|
82
|
+
The value must be positive (Default: 0).
|
|
83
|
+
"""
|
|
84
|
+
return self._b_emittance
|
|
85
|
+
|
|
86
|
+
@b_emittance.setter
|
|
87
|
+
def b_emittance(self, value):
|
|
88
|
+
self._b_emittance = typing.float_positive(value)
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_single_value(cls, identifier, rgb=0, modifier=None, dependencies=None):
|
|
92
|
+
"""Create light material with single value.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
96
|
+
or special characters. This will be used to identify the object across
|
|
97
|
+
a model and in the exported Radiance files.
|
|
98
|
+
rgb: Input for r_emittance, g_emittance and b_emittance. The value should be
|
|
99
|
+
between 0 and 1 (Default: 0).
|
|
100
|
+
modifier: Material modifier (Default: None).
|
|
101
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
102
|
+
argument is only useful for defining advanced primitives where the
|
|
103
|
+
primitive is defined based on other primitives. (Default: [])
|
|
104
|
+
|
|
105
|
+
Usage:
|
|
106
|
+
|
|
107
|
+
.. code-block:: python
|
|
108
|
+
|
|
109
|
+
sample_light = Light.from_single_value("sample_light", 1)
|
|
110
|
+
print(sample_light)
|
|
111
|
+
"""
|
|
112
|
+
return cls(identifier, r_emittance=rgb, g_emittance=rgb, b_emittance=rgb,
|
|
113
|
+
modifier=modifier, dependencies=dependencies)
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def from_primitive_dict(cls, primitive_dict):
|
|
117
|
+
"""Initialize Light from a primitive dict.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
data: A dictionary in the format below.
|
|
121
|
+
|
|
122
|
+
.. code-block:: python
|
|
123
|
+
|
|
124
|
+
{
|
|
125
|
+
"modifier": {} # primitive modifier (Default: None)
|
|
126
|
+
"type": "light", # primitive type
|
|
127
|
+
"identifier": "", # primitive identifier
|
|
128
|
+
"display_name": "", # primitive display name
|
|
129
|
+
"values": [], # values
|
|
130
|
+
"dependencies": []
|
|
131
|
+
}
|
|
132
|
+
"""
|
|
133
|
+
cls._dict_type_check(cls.__name__, primitive_dict)
|
|
134
|
+
modifier, dependencies = cls.filter_dict_input(primitive_dict)
|
|
135
|
+
values = primitive_dict['values'][2]
|
|
136
|
+
|
|
137
|
+
cls_ = cls(
|
|
138
|
+
identifier=primitive_dict["identifier"],
|
|
139
|
+
r_emittance=values[0],
|
|
140
|
+
g_emittance=values[1],
|
|
141
|
+
b_emittance=values[2],
|
|
142
|
+
modifier=modifier,
|
|
143
|
+
dependencies=dependencies
|
|
144
|
+
)
|
|
145
|
+
if 'display_name' in primitive_dict and \
|
|
146
|
+
primitive_dict['display_name'] is not None:
|
|
147
|
+
cls_.display_name = primitive_dict['display_name']
|
|
148
|
+
|
|
149
|
+
# this might look redundant but it is NOT. see glass for explanation.
|
|
150
|
+
cls_.values = primitive_dict['values']
|
|
151
|
+
return cls_
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def from_dict(cls, data):
|
|
155
|
+
"""Initialize Light from a dictionary.
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
data: A dictionary in the format below.
|
|
159
|
+
|
|
160
|
+
.. code-block:: python
|
|
161
|
+
|
|
162
|
+
{
|
|
163
|
+
"type": "Light", # primitive type
|
|
164
|
+
"identifier": "", # Material identifier
|
|
165
|
+
"display_name": "" # Material display name
|
|
166
|
+
"r_emittance": float, # A positive value for the Red channel of the glow
|
|
167
|
+
"g_emittance": float, # A positive value for the Green channel of the glow
|
|
168
|
+
"b_emittance": float, # A positive value for the Blue channel of the glow
|
|
169
|
+
"radius": float, # Maximum radius for shadow testing
|
|
170
|
+
"dependencies: []
|
|
171
|
+
}
|
|
172
|
+
"""
|
|
173
|
+
cls._dict_type_check(cls.__name__, data)
|
|
174
|
+
modifier, dependencies = cls.filter_dict_input(data)
|
|
175
|
+
|
|
176
|
+
new_obj = cls(identifier=data["identifier"],
|
|
177
|
+
r_emittance=data["r_emittance"],
|
|
178
|
+
g_emittance=data["g_emittance"],
|
|
179
|
+
b_emittance=data["b_emittance"],
|
|
180
|
+
modifier=modifier,
|
|
181
|
+
dependencies=dependencies)
|
|
182
|
+
if 'display_name' in data and data['display_name'] is not None:
|
|
183
|
+
new_obj.display_name = data['display_name']
|
|
184
|
+
return new_obj
|
|
185
|
+
|
|
186
|
+
def to_dict(self):
|
|
187
|
+
"""Translate this object to a dictionary."""
|
|
188
|
+
base = {
|
|
189
|
+
'modifier': self.modifier.to_dict(),
|
|
190
|
+
'type': 'Light',
|
|
191
|
+
'identifier': self.identifier,
|
|
192
|
+
'r_emittance': self.r_emittance,
|
|
193
|
+
'g_emittance': self.g_emittance,
|
|
194
|
+
'b_emittance': self.b_emittance,
|
|
195
|
+
'dependencies': [dp.to_dict() for dp in self.dependencies]
|
|
196
|
+
}
|
|
197
|
+
if self._display_name is not None:
|
|
198
|
+
base['display_name'] = self.display_name
|
|
199
|
+
return base
|
|
200
|
+
|
|
201
|
+
def __copy__(self):
|
|
202
|
+
mod, depend = self._dup_mod_and_depend()
|
|
203
|
+
new_obj = self.__class__(self.identifier, self.r_emittance, self.g_emittance,
|
|
204
|
+
self.b_emittance, mod, depend)
|
|
205
|
+
new_obj._display_name = self._display_name
|
|
206
|
+
return new_obj
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Base Radiance Material class (e.g plastic, glass, etc.).
|
|
2
|
+
|
|
3
|
+
More information on Radiance Materials can be found at:
|
|
4
|
+
|
|
5
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Materials
|
|
6
|
+
"""
|
|
7
|
+
from ..modifierbase import Modifier
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Material(Modifier):
|
|
11
|
+
"""Base class for Radiance materials.
|
|
12
|
+
|
|
13
|
+
Properties:
|
|
14
|
+
* identifier
|
|
15
|
+
* display_name
|
|
16
|
+
* values
|
|
17
|
+
* modifier
|
|
18
|
+
* dependencies
|
|
19
|
+
* is_modifier
|
|
20
|
+
* is_material
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
__slots__ = ()
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def is_material(self):
|
|
28
|
+
"""Get a boolean noting whether this object is a material modifier."""
|
|
29
|
+
return True
|
|
30
|
+
|
|
31
|
+
@staticmethod
|
|
32
|
+
def _dict_type_check(class_name, data):
|
|
33
|
+
"""Check that the 'type' key of a material dict suits the class."""
|
|
34
|
+
assert 'type' in data, 'Input dictionary is missing "type".'
|
|
35
|
+
if data['type'].lower() != class_name.lower():
|
|
36
|
+
raise ValueError('Type must be %s not %s.' % (class_name, data['type']))
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"""Radiance Metal Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Metal
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import division
|
|
6
|
+
|
|
7
|
+
from .plastic import Plastic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Metal(Plastic):
|
|
11
|
+
"""Radiance metal material.
|
|
12
|
+
|
|
13
|
+
Metal is similar to plastic, but specular highlights are modified by the
|
|
14
|
+
material color. Specularity of metals is usually .9 or greater.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
18
|
+
or special characters. This will be used to identify the object across
|
|
19
|
+
a model and in the exported Radiance files.
|
|
20
|
+
r_reflectance: Reflectance for red. The value should be between 0 and 1
|
|
21
|
+
(Default: 0).
|
|
22
|
+
g_reflectance: Reflectance for green. The value should be between 0 and 1
|
|
23
|
+
(Default: 0).
|
|
24
|
+
b_reflectance: Reflectance for blue. The value should be between 0 and 1
|
|
25
|
+
(Default: 0).
|
|
26
|
+
specularity: Fraction of specularity. Specularity of metals is usually
|
|
27
|
+
0.9 or greater. (Default: 0.9).
|
|
28
|
+
roughness: Roughness is specified as the rms slope of surface facets. A
|
|
29
|
+
value of 0 corresponds to a perfectly smooth surface, and a value of 1
|
|
30
|
+
would be a very rough surface. Roughness values greater than 0.2 are not
|
|
31
|
+
very realistic. (Default: 0).
|
|
32
|
+
modifier: Material modifier (Default: None).
|
|
33
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
34
|
+
argument is only useful for defining advanced primitives where the
|
|
35
|
+
primitive is defined based on other primitives. (Default: [])
|
|
36
|
+
|
|
37
|
+
Properties:
|
|
38
|
+
* identifier
|
|
39
|
+
* display_name
|
|
40
|
+
* r_reflectance
|
|
41
|
+
* g_reflectance
|
|
42
|
+
* b_reflectance
|
|
43
|
+
* specularity
|
|
44
|
+
* roughness
|
|
45
|
+
* average_reflectance
|
|
46
|
+
* values
|
|
47
|
+
* modifier
|
|
48
|
+
* dependencies
|
|
49
|
+
* is_modifier
|
|
50
|
+
* is_material
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
__slots__ = ()
|
|
54
|
+
|
|
55
|
+
def __init__(self, identifier, r_reflectance=0.0, g_reflectance=0.0, b_reflectance=0.0,
|
|
56
|
+
specularity=0.9, roughness=0.0, modifier=None, dependencies=None):
|
|
57
|
+
"""Create metal material."""
|
|
58
|
+
Plastic.__init__(self, identifier, r_reflectance, g_reflectance, b_reflectance,
|
|
59
|
+
specularity, roughness, modifier, dependencies)
|
|
60
|
+
|
|
61
|
+
def _update_values(self):
|
|
62
|
+
"update value dictionaries."
|
|
63
|
+
self._values[2] = [
|
|
64
|
+
self.r_reflectance, self.g_reflectance, self.b_reflectance,
|
|
65
|
+
self.specularity, self.roughness
|
|
66
|
+
]
|
|
67
|
+
if self.specularity < 0.9:
|
|
68
|
+
print("Warning: Specularity of metals is usually .9 or greater.")
|
|
69
|
+
if self.roughness > 0.2:
|
|
70
|
+
print("Warning: Roughness values above .2 is uncommon.")
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_single_reflectance(
|
|
74
|
+
cls, identifier, rgb_reflectance=0.0, specularity=0.9, roughness=0.0,
|
|
75
|
+
modifier=None, dependencies=None):
|
|
76
|
+
"""Create Metal material with single reflectance value.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
80
|
+
or special characters. This will be used to identify the object across
|
|
81
|
+
a model and in the exported Radiance files.
|
|
82
|
+
rgb_reflectance: Reflectance for red, green and blue. The value should be
|
|
83
|
+
between 0 and 1 (Default: 0).
|
|
84
|
+
specularity: Fraction of specularity. Specularity of metals is usually
|
|
85
|
+
0.9 or greater. (Default: 0.9).
|
|
86
|
+
roughness: Roughness is specified as the rms slope of surface facets. A value
|
|
87
|
+
of 0 corresponds to a perfectly smooth surface, and a value of 1 would be
|
|
88
|
+
a very rough surface. Roughness values greater than 0.2 are not very
|
|
89
|
+
realistic. (Default: 0).
|
|
90
|
+
modifier: Material modifier (Default: None).
|
|
91
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
92
|
+
argument is only useful for defining advanced primitives where the
|
|
93
|
+
primitive is defined based on other primitives. (Default: None).
|
|
94
|
+
|
|
95
|
+
Usage:
|
|
96
|
+
|
|
97
|
+
.. code-block:: python
|
|
98
|
+
|
|
99
|
+
wall_material = Metal.from_single_reflectance("sheet_metal", .55)
|
|
100
|
+
print(wall_material)
|
|
101
|
+
"""
|
|
102
|
+
return cls(identifier, r_reflectance=rgb_reflectance,
|
|
103
|
+
g_reflectance=rgb_reflectance, b_reflectance=rgb_reflectance,
|
|
104
|
+
specularity=specularity, roughness=roughness,
|
|
105
|
+
modifier=modifier, dependencies=dependencies)
|
|
106
|
+
|
|
107
|
+
@classmethod
|
|
108
|
+
def from_reflected_specularity(
|
|
109
|
+
cls, identifier, r_reflectance=0.0, g_reflectance=0.0, b_reflectance=0.0,
|
|
110
|
+
reflected_specularity=0.9, roughness=0.0, modifier=None, dependencies=None):
|
|
111
|
+
"""Create metal material from reflected specularity.
|
|
112
|
+
|
|
113
|
+
This method assumes that all of the input fractions for reflectance are
|
|
114
|
+
absolute fractions of the total amount of light hitting the modifier.
|
|
115
|
+
This is different than how Radiance natively interprets the properties.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
119
|
+
or special characters. This will be used to identify the object across
|
|
120
|
+
a model and in the exported Radiance files.
|
|
121
|
+
r_reflectance: Reflectance for red. The value should be between 0 and 1
|
|
122
|
+
(Default: 0).
|
|
123
|
+
g_reflectance: Reflectance for green. The value should be between 0 and 1
|
|
124
|
+
(Default: 0).
|
|
125
|
+
b_reflectance: Reflectance for blue. The value should be between 0 and 1
|
|
126
|
+
(Default: 0).
|
|
127
|
+
reflected_specularity: Fraction of reflected specular. Specularity
|
|
128
|
+
fractions greater than 0.1 are not common in non-metallic
|
|
129
|
+
materials. (Default: 0).
|
|
130
|
+
roughness: Roughness is specified as the rms slope of surface facets. A
|
|
131
|
+
value of 0 corresponds to a perfectly smooth surface, and a value of 1
|
|
132
|
+
would be a very rough surface. Roughness values greater than 0.2 are not
|
|
133
|
+
very realistic. (Default: 0).
|
|
134
|
+
modifier: Material modifier (Default: None).
|
|
135
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
136
|
+
argument is only useful for defining advanced primitives where the
|
|
137
|
+
primitive is defined based on other primitives. (Default: [])
|
|
138
|
+
"""
|
|
139
|
+
cr, cg, cb, rs = \
|
|
140
|
+
r_reflectance, g_reflectance, b_reflectance, reflected_specularity
|
|
141
|
+
|
|
142
|
+
rd = (0.265 * cr + 0.670 * cg + 0.065 * cb)
|
|
143
|
+
|
|
144
|
+
absorb = 1 - rd - rs
|
|
145
|
+
if absorb < 0:
|
|
146
|
+
summ = rd + rs
|
|
147
|
+
msg = 'Sum of Diffuse Reflection (%.3f) and Specular Reflection (%.3f) ' \
|
|
148
|
+
'cannot be more than 1 (%.3f).' % (rd, rs, summ)
|
|
149
|
+
raise ValueError(msg)
|
|
150
|
+
|
|
151
|
+
a1 = cr / ((1 - rs))
|
|
152
|
+
a2 = cg / ((1 - rs))
|
|
153
|
+
a3 = cb / ((1 - rs))
|
|
154
|
+
if a3 > 1 or a2 > 1 or a1 > 1:
|
|
155
|
+
if a1 > 1:
|
|
156
|
+
channel, val = 'Red', a1
|
|
157
|
+
elif a2 > 1:
|
|
158
|
+
channel, val = 'Green', a2
|
|
159
|
+
else:
|
|
160
|
+
channel, val = 'Blue', a3
|
|
161
|
+
raise ValueError(
|
|
162
|
+
'This material has a physically impossible reflectance value for '
|
|
163
|
+
'the {} channel\nwhen specular and diffuse fractions are added '
|
|
164
|
+
'({}).'.format(channel, val))
|
|
165
|
+
|
|
166
|
+
return cls(identifier, a1, a2, a3, rs, roughness,
|
|
167
|
+
modifier=modifier, dependencies=dependencies)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Radiance Metal2 Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Metal2
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Metal2(Material):
|
|
10
|
+
"""Radiance Metal2 Material.
|
|
11
|
+
|
|
12
|
+
Metal2 is the same as plastic2, except that the highlights are modified by the
|
|
13
|
+
material color.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
17
|
+
or special characters. This will be used to identify the object across
|
|
18
|
+
a model and in the exported Radiance files.
|
|
19
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
20
|
+
(Default: None).
|
|
21
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
22
|
+
refer to a line number in the radiance primitive definitions and the
|
|
23
|
+
values in each array correspond to values occurring within each line.
|
|
24
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
25
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
26
|
+
argument is only useful for defining advanced primitives that are
|
|
27
|
+
defined based on other primitives. (Default: []).
|
|
28
|
+
|
|
29
|
+
Properties:
|
|
30
|
+
* identifier
|
|
31
|
+
* display_name
|
|
32
|
+
* values
|
|
33
|
+
* modifier
|
|
34
|
+
* dependencies
|
|
35
|
+
* is_modifier
|
|
36
|
+
* is_material
|
|
37
|
+
* is_opaque
|
|
38
|
+
"""
|
|
39
|
+
__slots__ = ()
|
|
40
|
+
|
|
41
|
+
pass
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Radiance Metdata Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Metdata
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Metdata(Material):
|
|
10
|
+
"""Radiance Metdata Material.
|
|
11
|
+
|
|
12
|
+
As metfunc is to plasfunc, metdata is to plasdata. Metdata takes the same arguments
|
|
13
|
+
as plasdata, but the specular component is modified by the given material color.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
17
|
+
or special characters. This will be used to identify the object across
|
|
18
|
+
a model and in the exported Radiance files.
|
|
19
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
20
|
+
(Default: None).
|
|
21
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
22
|
+
refer to a line number in the radiance primitive definitions and the
|
|
23
|
+
values in each array correspond to values occurring within each line.
|
|
24
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
25
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
26
|
+
argument is only useful for defining advanced primitives that are
|
|
27
|
+
defined based on other primitives. (Default: []).
|
|
28
|
+
|
|
29
|
+
Properties:
|
|
30
|
+
* identifier
|
|
31
|
+
* display_name
|
|
32
|
+
* values
|
|
33
|
+
* modifier
|
|
34
|
+
* dependencies
|
|
35
|
+
* is_modifier
|
|
36
|
+
* is_material
|
|
37
|
+
* is_opaque
|
|
38
|
+
"""
|
|
39
|
+
__slots__ = ()
|
|
40
|
+
|
|
41
|
+
pass
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Radiance Metfunc Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Metfunc
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Metfunc(Material):
|
|
10
|
+
"""Radiance Metfunc Material.
|
|
11
|
+
|
|
12
|
+
Metfunc is identical to plasfunc and takes the same arguments, but the specular
|
|
13
|
+
component is multiplied also by the material color.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
17
|
+
or special characters. This will be used to identify the object across
|
|
18
|
+
a model and in the exported Radiance files.
|
|
19
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
20
|
+
(Default: None).
|
|
21
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
22
|
+
refer to a line number in the radiance primitive definitions and the
|
|
23
|
+
values in each array correspond to values occurring within each line.
|
|
24
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
25
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
26
|
+
argument is only useful for defining advanced primitives that are
|
|
27
|
+
defined based on other primitives. (Default: []).
|
|
28
|
+
|
|
29
|
+
Properties:
|
|
30
|
+
* identifier
|
|
31
|
+
* display_name
|
|
32
|
+
* values
|
|
33
|
+
* modifier
|
|
34
|
+
* dependencies
|
|
35
|
+
* is_modifier
|
|
36
|
+
* is_material
|
|
37
|
+
* is_opaque
|
|
38
|
+
"""
|
|
39
|
+
__slots__ = ()
|
|
40
|
+
|
|
41
|
+
pass
|