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.

Files changed (152) hide show
  1. honeybee_radiance/__init__.py +11 -0
  2. honeybee_radiance/__main__.py +4 -0
  3. honeybee_radiance/_extend_honeybee.py +93 -0
  4. honeybee_radiance/cli/__init__.py +88 -0
  5. honeybee_radiance/cli/dc.py +400 -0
  6. honeybee_radiance/cli/edit.py +529 -0
  7. honeybee_radiance/cli/glare.py +118 -0
  8. honeybee_radiance/cli/grid.py +859 -0
  9. honeybee_radiance/cli/lib.py +458 -0
  10. honeybee_radiance/cli/modifier.py +133 -0
  11. honeybee_radiance/cli/mtx.py +226 -0
  12. honeybee_radiance/cli/multiphase.py +1034 -0
  13. honeybee_radiance/cli/octree.py +640 -0
  14. honeybee_radiance/cli/postprocess.py +1186 -0
  15. honeybee_radiance/cli/raytrace.py +219 -0
  16. honeybee_radiance/cli/rpict.py +125 -0
  17. honeybee_radiance/cli/schedule.py +56 -0
  18. honeybee_radiance/cli/setconfig.py +63 -0
  19. honeybee_radiance/cli/sky.py +545 -0
  20. honeybee_radiance/cli/study.py +66 -0
  21. honeybee_radiance/cli/sunpath.py +331 -0
  22. honeybee_radiance/cli/threephase.py +255 -0
  23. honeybee_radiance/cli/translate.py +400 -0
  24. honeybee_radiance/cli/util.py +121 -0
  25. honeybee_radiance/cli/view.py +261 -0
  26. honeybee_radiance/cli/viewfactor.py +347 -0
  27. honeybee_radiance/config.json +6 -0
  28. honeybee_radiance/config.py +427 -0
  29. honeybee_radiance/dictutil.py +50 -0
  30. honeybee_radiance/dynamic/__init__.py +5 -0
  31. honeybee_radiance/dynamic/group.py +479 -0
  32. honeybee_radiance/dynamic/multiphase.py +557 -0
  33. honeybee_radiance/dynamic/state.py +718 -0
  34. honeybee_radiance/dynamic/stategeo.py +352 -0
  35. honeybee_radiance/geometry/__init__.py +13 -0
  36. honeybee_radiance/geometry/bubble.py +42 -0
  37. honeybee_radiance/geometry/cone.py +215 -0
  38. honeybee_radiance/geometry/cup.py +54 -0
  39. honeybee_radiance/geometry/cylinder.py +197 -0
  40. honeybee_radiance/geometry/geometrybase.py +37 -0
  41. honeybee_radiance/geometry/instance.py +40 -0
  42. honeybee_radiance/geometry/mesh.py +38 -0
  43. honeybee_radiance/geometry/polygon.py +174 -0
  44. honeybee_radiance/geometry/ring.py +214 -0
  45. honeybee_radiance/geometry/source.py +182 -0
  46. honeybee_radiance/geometry/sphere.py +178 -0
  47. honeybee_radiance/geometry/tube.py +46 -0
  48. honeybee_radiance/lib/__init__.py +1 -0
  49. honeybee_radiance/lib/_loadmodifiers.py +72 -0
  50. honeybee_radiance/lib/_loadmodifiersets.py +69 -0
  51. honeybee_radiance/lib/modifiers.py +58 -0
  52. honeybee_radiance/lib/modifiersets.py +63 -0
  53. honeybee_radiance/lightpath.py +204 -0
  54. honeybee_radiance/lightsource/__init__.py +1 -0
  55. honeybee_radiance/lightsource/_gendaylit.py +479 -0
  56. honeybee_radiance/lightsource/dictutil.py +49 -0
  57. honeybee_radiance/lightsource/ground.py +160 -0
  58. honeybee_radiance/lightsource/sky/__init__.py +7 -0
  59. honeybee_radiance/lightsource/sky/_skybase.py +177 -0
  60. honeybee_radiance/lightsource/sky/certainirradiance.py +232 -0
  61. honeybee_radiance/lightsource/sky/cie.py +378 -0
  62. honeybee_radiance/lightsource/sky/climatebased.py +501 -0
  63. honeybee_radiance/lightsource/sky/hemisphere.py +160 -0
  64. honeybee_radiance/lightsource/sky/skydome.py +113 -0
  65. honeybee_radiance/lightsource/sky/skymatrix.py +163 -0
  66. honeybee_radiance/lightsource/sky/strutil.py +34 -0
  67. honeybee_radiance/lightsource/sky/sunmatrix.py +212 -0
  68. honeybee_radiance/lightsource/sunpath.py +247 -0
  69. honeybee_radiance/modifier/__init__.py +3 -0
  70. honeybee_radiance/modifier/material/__init__.py +30 -0
  71. honeybee_radiance/modifier/material/absdf.py +477 -0
  72. honeybee_radiance/modifier/material/antimatter.py +54 -0
  73. honeybee_radiance/modifier/material/ashik2.py +51 -0
  74. honeybee_radiance/modifier/material/brtdfunc.py +81 -0
  75. honeybee_radiance/modifier/material/bsdf.py +292 -0
  76. honeybee_radiance/modifier/material/dielectric.py +53 -0
  77. honeybee_radiance/modifier/material/glass.py +431 -0
  78. honeybee_radiance/modifier/material/glow.py +246 -0
  79. honeybee_radiance/modifier/material/illum.py +51 -0
  80. honeybee_radiance/modifier/material/interface.py +49 -0
  81. honeybee_radiance/modifier/material/light.py +206 -0
  82. honeybee_radiance/modifier/material/materialbase.py +36 -0
  83. honeybee_radiance/modifier/material/metal.py +167 -0
  84. honeybee_radiance/modifier/material/metal2.py +41 -0
  85. honeybee_radiance/modifier/material/metdata.py +41 -0
  86. honeybee_radiance/modifier/material/metfunc.py +41 -0
  87. honeybee_radiance/modifier/material/mirror.py +340 -0
  88. honeybee_radiance/modifier/material/mist.py +86 -0
  89. honeybee_radiance/modifier/material/plasdata.py +58 -0
  90. honeybee_radiance/modifier/material/plasfunc.py +59 -0
  91. honeybee_radiance/modifier/material/plastic.py +354 -0
  92. honeybee_radiance/modifier/material/plastic2.py +58 -0
  93. honeybee_radiance/modifier/material/prism1.py +57 -0
  94. honeybee_radiance/modifier/material/prism2.py +48 -0
  95. honeybee_radiance/modifier/material/spotlight.py +50 -0
  96. honeybee_radiance/modifier/material/trans.py +518 -0
  97. honeybee_radiance/modifier/material/trans2.py +49 -0
  98. honeybee_radiance/modifier/material/transdata.py +50 -0
  99. honeybee_radiance/modifier/material/transfunc.py +53 -0
  100. honeybee_radiance/modifier/mixture/__init__.py +6 -0
  101. honeybee_radiance/modifier/mixture/mixdata.py +49 -0
  102. honeybee_radiance/modifier/mixture/mixfunc.py +54 -0
  103. honeybee_radiance/modifier/mixture/mixpict.py +52 -0
  104. honeybee_radiance/modifier/mixture/mixtext.py +66 -0
  105. honeybee_radiance/modifier/mixture/mixturebase.py +28 -0
  106. honeybee_radiance/modifier/modifierbase.py +40 -0
  107. honeybee_radiance/modifier/pattern/__init__.py +9 -0
  108. honeybee_radiance/modifier/pattern/brightdata.py +49 -0
  109. honeybee_radiance/modifier/pattern/brightfunc.py +47 -0
  110. honeybee_radiance/modifier/pattern/brighttext.py +81 -0
  111. honeybee_radiance/modifier/pattern/colordata.py +56 -0
  112. honeybee_radiance/modifier/pattern/colorfunc.py +47 -0
  113. honeybee_radiance/modifier/pattern/colorpict.py +54 -0
  114. honeybee_radiance/modifier/pattern/colortext.py +73 -0
  115. honeybee_radiance/modifier/pattern/patternbase.py +34 -0
  116. honeybee_radiance/modifier/texture/__init__.py +4 -0
  117. honeybee_radiance/modifier/texture/texdata.py +29 -0
  118. honeybee_radiance/modifier/texture/texfunc.py +26 -0
  119. honeybee_radiance/modifier/texture/texturebase.py +27 -0
  120. honeybee_radiance/modifierset.py +1091 -0
  121. honeybee_radiance/mutil.py +60 -0
  122. honeybee_radiance/postprocess/__init__.py +1 -0
  123. honeybee_radiance/postprocess/annual.py +108 -0
  124. honeybee_radiance/postprocess/annualdaylight.py +425 -0
  125. honeybee_radiance/postprocess/annualglare.py +201 -0
  126. honeybee_radiance/postprocess/annualirradiance.py +187 -0
  127. honeybee_radiance/postprocess/electriclight.py +119 -0
  128. honeybee_radiance/postprocess/en17037.py +261 -0
  129. honeybee_radiance/postprocess/leed.py +304 -0
  130. honeybee_radiance/postprocess/solartracking.py +90 -0
  131. honeybee_radiance/primitive.py +554 -0
  132. honeybee_radiance/properties/__init__.py +1 -0
  133. honeybee_radiance/properties/_base.py +390 -0
  134. honeybee_radiance/properties/aperture.py +197 -0
  135. honeybee_radiance/properties/door.py +198 -0
  136. honeybee_radiance/properties/face.py +123 -0
  137. honeybee_radiance/properties/model.py +1291 -0
  138. honeybee_radiance/properties/room.py +490 -0
  139. honeybee_radiance/properties/shade.py +186 -0
  140. honeybee_radiance/properties/shademesh.py +116 -0
  141. honeybee_radiance/putil.py +44 -0
  142. honeybee_radiance/reader.py +214 -0
  143. honeybee_radiance/sensor.py +166 -0
  144. honeybee_radiance/sensorgrid.py +1008 -0
  145. honeybee_radiance/view.py +1101 -0
  146. honeybee_radiance/writer.py +951 -0
  147. honeybee_radiance-1.66.190.dist-info/METADATA +89 -0
  148. honeybee_radiance-1.66.190.dist-info/RECORD +152 -0
  149. honeybee_radiance-1.66.190.dist-info/WHEEL +5 -0
  150. honeybee_radiance-1.66.190.dist-info/entry_points.txt +2 -0
  151. honeybee_radiance-1.66.190.dist-info/licenses/LICENSE +661 -0
  152. honeybee_radiance-1.66.190.dist-info/top_level.txt +1 -0
@@ -0,0 +1,518 @@
1
+ """Radiance Trans Material.
2
+
3
+ http://radsite.lbl.gov/radiance/refer/ray.html#Trans
4
+ https://radiance-online.org//community/workshops/2010-freiburg/PDF/DavidMead.pdf
5
+ """
6
+ from __future__ import division
7
+
8
+ from .materialbase import Material
9
+ import honeybee.typing as typing
10
+
11
+
12
+ class Trans(Material):
13
+ """Radiance translucent material.
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
+ r_reflectance: Reflectance for red. The value should be between 0 and 1
20
+ (Default: 0).
21
+ g_reflectance: Reflectance for green. The value should be between 0 and 1
22
+ (Default: 0).
23
+ b_reflectance: Reflectance for blue. The value should be between 0 and 1
24
+ (Default: 0).
25
+ specularity: Fraction of specularity. Specularity fractions greater than 0.1
26
+ are not common in non-metallic materials (Default: 0).
27
+ roughness: Roughness is specified as the rms slope of surface facets. A
28
+ value of 0 corresponds to a perfectly smooth surface, and a value of 1
29
+ would be a very rough surface. Roughness values greater than 0.2 are not
30
+ very realistic. (Default: 0).
31
+ transmitted_diff: The transmitted diffuse component is the fraction of
32
+ transmitted light that is transmitted diffusely in as scattering fashion.
33
+ transmitted_spec: The transmitted specular component is the fraction of
34
+ transmitted light that is not diffusely scattered.
35
+ modifier: Material modifier (Default: None).
36
+ dependencies: A list of primitives that this primitive depends on. This
37
+ argument is only useful for defining advanced primitives where the
38
+ primitive is defined based on other primitives. (Default: None)
39
+
40
+ Properties:
41
+ * identifier
42
+ * display_name
43
+ * r_reflectance
44
+ * g_reflectance
45
+ * b_reflectance
46
+ * specularity
47
+ * roughness
48
+ * transmitted_diff
49
+ * transmitted_spec
50
+ * average_reflectance
51
+ * average_absorption
52
+ * average_transmittance
53
+ * diffuse_reflectance
54
+ * diffuse_transmittance
55
+ * specular_transmittance
56
+ * specular_sampling_threshold
57
+ * values
58
+ * modifier
59
+ * dependencies
60
+ * is_modifier
61
+ * is_material
62
+ """
63
+ __slots__ = ('_r_reflectance', '_g_reflectance', '_b_reflectance',
64
+ '_specularity', '_roughness', '_transmitted_diff', '_transmitted_spec')
65
+
66
+ def __init__(
67
+ self, identifier, r_reflectance=0.0, g_reflectance=0.0, b_reflectance=0.0,
68
+ specularity=0.0, roughness=0.0, transmitted_diff=0.0,
69
+ transmitted_spec=0.0, modifier=None, dependencies=None
70
+ ):
71
+ """Create trans material."""
72
+ Material.__init__(self, identifier, modifier=modifier,
73
+ dependencies=dependencies)
74
+ self.r_reflectance = r_reflectance
75
+ self.g_reflectance = g_reflectance
76
+ self.b_reflectance = b_reflectance
77
+ self.specularity = specularity
78
+ self.roughness = roughness
79
+ self.transmitted_diff = transmitted_diff
80
+ self.transmitted_spec = transmitted_spec
81
+ self._update_values()
82
+
83
+ def _update_values(self):
84
+ "update value dictionaries."
85
+ self._values[2] = [
86
+ self.r_reflectance, self.g_reflectance, self.b_reflectance,
87
+ self.specularity, self.roughness, self.transmitted_diff,
88
+ self.transmitted_spec
89
+ ]
90
+
91
+ @property
92
+ def r_reflectance(self):
93
+ """Get or set the reflectance for red channel.
94
+
95
+ The value should be between 0 and 1 (Default: 0).
96
+ """
97
+ return self._r_reflectance
98
+
99
+ @r_reflectance.setter
100
+ def r_reflectance(self, reflectance):
101
+ self._r_reflectance = \
102
+ typing.float_in_range(reflectance, 0, 1, 'red reflectance')
103
+
104
+ @property
105
+ def g_reflectance(self):
106
+ """Get or set the reflectance for green channel.
107
+
108
+ The value should be between 0 and 1 (Default: 0).
109
+ """
110
+ return self._g_reflectance
111
+
112
+ @g_reflectance.setter
113
+ def g_reflectance(self, reflectance):
114
+ self._g_reflectance = \
115
+ typing.float_in_range(reflectance, 0, 1, 'green reflectance')
116
+
117
+ @property
118
+ def b_reflectance(self):
119
+ """Get or set the reflectance for blue channel.
120
+
121
+ The value should be between 0 and 1 (Default: 0).
122
+ """
123
+ return self._b_reflectance
124
+
125
+ @b_reflectance.setter
126
+ def b_reflectance(self, reflectance):
127
+ self._b_reflectance = \
128
+ typing.float_in_range(reflectance, 0, 1, 'blue reflectance')
129
+
130
+ @property
131
+ def specularity(self):
132
+ """Get or set the fraction of specularity.
133
+
134
+ In most cases specularity fractions greater than 0.1 are not common in
135
+ non-metallic materials (Default: 0).
136
+ """
137
+ return self._specularity
138
+
139
+ @specularity.setter
140
+ def specularity(self, spec_value):
141
+ self._specularity = typing.float_in_range(spec_value, 0, 1, 'specularity')
142
+
143
+ @property
144
+ def roughness(self):
145
+ """Get or set the roughness as the rms slope of surface facets.
146
+
147
+ A value of 0 corresponds to a perfectly smooth surface, and a value of 1
148
+ would be a very rough surface. Roughness values greater than 0.2 are not
149
+ very realistic. (Default: 0).
150
+ """
151
+ return self._roughness
152
+
153
+ @roughness.setter
154
+ def roughness(self, roughness_value):
155
+ self._roughness = typing.float_in_range(roughness_value, 0, 1, 'roughness')
156
+
157
+ @property
158
+ def transmitted_diff(self):
159
+ """Get or set the transmitted diffuse.
160
+
161
+ The transmitted diffuse component is the fraction of transmitted light that is
162
+ transmitted diffusely in as scattering fashion.
163
+ """
164
+ return self._transmitted_diff
165
+
166
+ @transmitted_diff.setter
167
+ def transmitted_diff(self, value):
168
+ self._transmitted_diff = \
169
+ typing.float_in_range(value, 0, 1, 'diffuse transmission')
170
+
171
+ @property
172
+ def transmitted_spec(self):
173
+ """Get or set the transmitted specular.
174
+
175
+ The transmitted specular component is the fraction of transmitted light that is
176
+ not diffusely scattered.
177
+ """
178
+ return self._transmitted_spec
179
+
180
+ @transmitted_spec.setter
181
+ def transmitted_spec(self, value):
182
+ self._transmitted_spec = \
183
+ typing.float_in_range(value, 0, 1, 'specular transmission')
184
+
185
+ @property
186
+ def average_reflectance(self):
187
+ """Get the average reflectance of over the RGB values of the material."""
188
+ col_ref = 0.265 * self.r_reflectance + 0.670 * self.g_reflectance + \
189
+ 0.065 * self.b_reflectance
190
+ dif_ref = (1 - self._specularity) * col_ref * (1 - self._transmitted_diff)
191
+ return self._specularity + dif_ref
192
+
193
+ @property
194
+ def average_absorption(self):
195
+ """Get the average absorption of over the RGB values of the material."""
196
+ return (1 - (0.265 * self.r_reflectance + 0.670 * self.g_reflectance +
197
+ 0.065 * self.b_reflectance)) * (1 - self._specularity)
198
+
199
+ @property
200
+ def average_transmittance(self):
201
+ """Get the total transmittance over the material."""
202
+ return (1 - self._specularity) * self._transmitted_diff * \
203
+ (0.265 * self.r_reflectance + 0.670 * self.g_reflectance + 0.065 *
204
+ self.b_reflectance)
205
+
206
+ @property
207
+ def diffuse_reflectance(self):
208
+ """Get the average diffuse reflectance of over the RGB values of the material."""
209
+ col_ref = 0.265 * self.r_reflectance + 0.670 * self.g_reflectance + \
210
+ 0.065 * self.b_reflectance
211
+ return (1 - self._specularity) * col_ref * (1 - self._transmitted_diff)
212
+
213
+ @property
214
+ def diffuse_transmittance(self):
215
+ """Get the total transmitted diffuse component."""
216
+ return self.average_transmittance * (1 - self._transmitted_spec)
217
+
218
+ @property
219
+ def specular_transmittance(self):
220
+ """Get the total transmitted specular component."""
221
+ return self.average_transmittance * self._transmitted_spec
222
+
223
+ @property
224
+ def specular_sampling_threshold(self):
225
+ """Get the suggested specular sampling threshold (-st)."""
226
+ return self.transmitted_diff * self.transmitted_spec * \
227
+ (1 - (0.265 * self.r_reflectance + 0.670 * self.g_reflectance +
228
+ 0.065 * self.b_reflectance)) * self.specularity
229
+
230
+ @classmethod
231
+ def from_reflected_specularity(
232
+ cls, identifier, r_reflectance=0.0, g_reflectance=0.0, b_reflectance=0.0,
233
+ reflected_specularity=0.0, roughness=0.0, transmitted_diff=0.0,
234
+ transmitted_spec=0.0, modifier=None, dependencies=None):
235
+ """Create trans material from reflected specularity.
236
+
237
+ This method assumes that all of the input fractions for reflectance and
238
+ transmittance are absolute fractions of the total amount of light hitting
239
+ the modifier. This is different than how Radiance natively interprets
240
+ the properties.
241
+
242
+ Note:
243
+ https://radiance-online.org//community/workshops/2010-freiburg/PDF/DavidMead.pdf
244
+
245
+ Args:
246
+ identifier: Text string for a unique Material ID. Must not contain spaces
247
+ or special characters. This will be used to identify the object across
248
+ a model and in the exported Radiance files.
249
+ r_reflectance: Reflectance for red. The value should be between 0 and 1
250
+ (Default: 0).
251
+ g_reflectance: Reflectance for green. The value should be between 0 and 1
252
+ (Default: 0).
253
+ b_reflectance: Reflectance for blue. The value should be between 0 and 1
254
+ (Default: 0).
255
+ reflected_specularity: Fraction of reflected specular. The reflected
256
+ specularity of common uncoated glass is around .06, Matte = min 0,
257
+ Satin = suggested max 0.07 (Default: 0).
258
+ roughness: Roughness is specified as the rms slope of surface facets. A
259
+ value of 0 corresponds to a perfectly smooth surface, and a value of 1
260
+ would be a very rough surface. Roughness values greater than 0.2 are not
261
+ very realistic. (Default: 0).
262
+ transmitted_diff: The transmitted diffuse component is the fraction of
263
+ transmitted light that is transmitted diffusely in as scattering fashion.
264
+ transmitted_spec: The transmitted specular component is the fraction of
265
+ transmitted light that is not diffusely scattered.
266
+ modifier: Material modifier (Default: None).
267
+ dependencies: A list of primitives that this primitive depends on. This
268
+ argument is only useful for defining advanced primitives where the
269
+ primitive is defined based on other primitives. (Default: [])
270
+ """
271
+ cr, cg, cb, rs, roughness, td, ts = \
272
+ r_reflectance, g_reflectance, b_reflectance, reflected_specularity, \
273
+ roughness, transmitted_diff, transmitted_spec
274
+
275
+ rd = (0.265 * cr + 0.670 * cg + 0.065 * cb)
276
+
277
+ absorb = 1 - td - ts - rd - rs
278
+
279
+ if absorb < 0:
280
+ summ = td + ts + rd + rs
281
+ msg = 'Sum of Diffuse Transmission (%.3f), Specular Transmission (%.3f),' \
282
+ 'Specular Reflection (%.3f) and Diffuse Reflection (%.3f) cannot be ' \
283
+ 'more than 1 (%.3f).' % (td, ts, rs, rd, summ)
284
+ raise ValueError(msg)
285
+
286
+ # calculate the material
287
+ try:
288
+ a7 = ts / (td + ts)
289
+ except ZeroDivisionError:
290
+ a7 = 0
291
+ try:
292
+ a6 = (td + ts) / (rd + td + ts)
293
+ except ZeroDivisionError:
294
+ a6 = 0
295
+ a5 = roughness
296
+ a4 = rs
297
+ a3 = cb / ((1 - rs) * (1 - a6))
298
+ a2 = cg / ((1 - rs) * (1 - a6))
299
+ a1 = cr / ((1 - rs) * (1 - a6))
300
+
301
+ if a3 > 1 or a2 > 1 or a1 > 1:
302
+ if a1 > 1:
303
+ channel, val = 'Red', a1
304
+ elif a2 > 1:
305
+ channel, val = 'Green', a2
306
+ else:
307
+ channel, val = 'Blue', a3
308
+ raise ValueError(
309
+ 'This material has a physically impossible reflectance value for '
310
+ 'the {} channel\nwhen specular and diffuse fractions are added '
311
+ '({}).'.format(channel, val))
312
+
313
+ return cls(identifier, a1, a2, a3, a4, a5, a6, a7, modifier,
314
+ dependencies=dependencies)
315
+
316
+ @classmethod
317
+ def from_single_reflectance(
318
+ cls, identifier, rgb_reflectance=0.0, specularity=0.0, roughness=0.0,
319
+ transmitted_diff=0.0, transmitted_spec=0.0, modifier=None, dependencies=None
320
+ ):
321
+ """Create trans material with single reflectance value.
322
+
323
+ Args:
324
+ identifier: Text string for a unique Material ID. Must not contain spaces
325
+ or special characters. This will be used to identify the object across
326
+ a model and in the exported Radiance files.
327
+ rgb_reflectance: Reflectance for red, green and blue. The value should be
328
+ between 0 and 1 (Default: 0).
329
+ specularity: Fraction of specularity. Specularity fractions greater than 0.1
330
+ are not common in non-metallic materials (Default: 0).
331
+ roughness: Roughness is specified as the rms slope of surface facets. A value
332
+ of 0 corresponds to a perfectly smooth surface, and a value of 1 would be
333
+ a very rough surface. Roughness values greater than 0.2 are not very
334
+ realistic. (Default: 0).
335
+ transmitted_diff: The transmitted diffuse component is the fraction of
336
+ transmitted light that is transmitted diffusely in a scattering fashion.
337
+ transmitted_spec: The transmitted specular component is the fraction of
338
+ transmitted light that is not diffusely scattered.
339
+ modifier: Material modifier (Default: None).
340
+ dependencies: A list of primitives that this primitive depends on. This
341
+ argument is only useful for defining advanced primitives where the
342
+ primitive is defined based on other primitives. (Default: [])
343
+ """
344
+ return cls(
345
+ identifier, r_reflectance=rgb_reflectance, g_reflectance=rgb_reflectance,
346
+ b_reflectance=rgb_reflectance, specularity=specularity, roughness=roughness,
347
+ transmitted_diff=transmitted_diff, transmitted_spec=transmitted_spec,
348
+ modifier=modifier, dependencies=dependencies)
349
+
350
+ @classmethod
351
+ def from_average_properties(
352
+ cls, identifier, average_reflectance=0.0, average_transmittance=0.0,
353
+ is_specular=False, is_diffusing=True, roughness=0.0,
354
+ modifier=None, dependencies=None
355
+ ):
356
+ """Create trans material from average reflectance and transmittance.
357
+
358
+ The sum of average_reflectance and average_transmittance must be less than
359
+ one and any energy not transmitted or reflected is assumed to be absorbed.
360
+ The resulting material will always be grey with equivalent red, green and
361
+ blue channels.
362
+
363
+ Args:
364
+ identifier: Text string for a unique Material ID. Must not contain spaces
365
+ or special characters. This will be used to identify the object across
366
+ a model and in the exported Radiance files.
367
+ average_reflectance: The average reflectance of the material. The value
368
+ should be between 0 and 1 (Default: 0).
369
+ average_transmittance: The average transmittance of the material. The value
370
+ should be between 0 and 1 (Default: 0).
371
+ is_specular: Boolean to note if the reflected component is specular (True)
372
+ or diffuse (False). (Default: False).
373
+ is_diffusing: Boolean to note if the transmitted component is diffused (True)
374
+ instead of specular like glass (False). (Default: True).
375
+ roughness: Roughness is specified as the rms slope of surface facets. A value
376
+ of 0 corresponds to a perfectly smooth surface, and a value of 1 would be
377
+ a very rough surface. Roughness values greater than 0.2 are not very
378
+ realistic. (Default: 0).
379
+ modifier: Material modifier (Default: None).
380
+ dependencies: A list of primitives that this primitive depends on. This
381
+ argument is only useful for defining advanced primitives where the
382
+ primitive is defined based on other primitives. (Default: [])
383
+ """
384
+ # check to be sure the input values are valid
385
+ absorb = 1 - average_reflectance - average_transmittance
386
+ assert absorb >= 0, 'Sum of average_reflectance and average_transmittance ' \
387
+ 'must be less than or equal to one. Got {}.'.format(
388
+ average_reflectance + average_transmittance)
389
+ # determine the reflectance values
390
+ if is_specular:
391
+ spec_ref = average_reflectance
392
+ diff_ref = average_transmittance / (1 - average_reflectance)
393
+ total_trans = 1
394
+ else:
395
+ spec_ref, total_ref = 0, 1 - absorb
396
+ diff_ref = total_ref
397
+ total_trans = average_transmittance / total_ref if total_ref != 0 else 0
398
+ # determine the transmittance values
399
+ if is_diffusing:
400
+ diff_trans, spec_trans = total_trans, 0
401
+ else:
402
+ diff_trans, spec_trans = total_trans, 1
403
+ # create the modifier
404
+ return cls.from_single_reflectance(
405
+ identifier, rgb_reflectance=diff_ref, specularity=spec_ref,
406
+ transmitted_diff=diff_trans, transmitted_spec=spec_trans,
407
+ roughness=roughness, modifier=modifier, dependencies=dependencies)
408
+
409
+ @classmethod
410
+ def from_primitive_dict(cls, primitive_dict):
411
+ """Initialize Trans from a primitive dict.
412
+
413
+ Args:
414
+ data: A dictionary in the format below.
415
+
416
+ .. code-block:: python
417
+
418
+ {
419
+ "modifier": {}, # primitive modifier (Default: None)
420
+ "type": "trans", # primitive type
421
+ "identifier": "", # primitive identifier
422
+ "display_name": "", # primitive display name
423
+ "values": [], # values
424
+ "dependencies": []
425
+ }
426
+ """
427
+ cls._dict_type_check(cls.__name__, primitive_dict)
428
+ modifier, dependencies = cls.filter_dict_input(primitive_dict)
429
+ values = primitive_dict['values'][2]
430
+
431
+ cls_ = cls(
432
+ identifier=primitive_dict["identifier"],
433
+ r_reflectance=values[0],
434
+ g_reflectance=values[1],
435
+ b_reflectance=values[2],
436
+ specularity=values[3],
437
+ roughness=values[4],
438
+ transmitted_diff=values[5],
439
+ transmitted_spec=values[6],
440
+ modifier=modifier,
441
+ dependencies=dependencies)
442
+ if 'display_name' in primitive_dict and \
443
+ primitive_dict['display_name'] is not None:
444
+ cls_.display_name = primitive_dict['display_name']
445
+
446
+ # this might look redundant but it is NOT. see glass for explanation.
447
+ cls_.values = primitive_dict['values']
448
+ return cls_
449
+
450
+ @classmethod
451
+ def from_dict(cls, data):
452
+ """Initialize Trans from a dictionary.
453
+
454
+ Args:
455
+ data: A dictionary in the format below.
456
+
457
+ .. code-block:: python
458
+
459
+ {
460
+ "type": "Trans", # Material type
461
+ "identifier": "", # Material identifier
462
+ "display_name": "", # Material display name
463
+ "r_reflectance": float, # Reflectance for red
464
+ "g_reflectance": float, # Reflectance for green
465
+ "b_reflectance": float, # Reflectance for blue
466
+ "specularity": float, # Material specularity
467
+ "roughness": float, # Material roughness
468
+ "transmitted_diff": float,
469
+ "transmitted_spec": float,
470
+ "dependencies": []
471
+ "modifier": {}, # Material modifier (Default: None)
472
+ }
473
+ """
474
+ cls._dict_type_check(cls.__name__, data)
475
+ modifier, dependencies = cls.filter_dict_input(data)
476
+
477
+ new_obj = cls(
478
+ identifier=data["identifier"],
479
+ r_reflectance=data["r_reflectance"],
480
+ g_reflectance=data["g_reflectance"],
481
+ b_reflectance=data["b_reflectance"],
482
+ specularity=data["specularity"],
483
+ roughness=data["roughness"],
484
+ transmitted_diff=data["transmitted_diff"],
485
+ transmitted_spec=data["transmitted_spec"],
486
+ modifier=modifier,
487
+ dependencies=dependencies)
488
+ if 'display_name' in data and data['display_name'] is not None:
489
+ new_obj.display_name = data['display_name']
490
+ return new_obj
491
+
492
+ def to_dict(self):
493
+ """Translate this object to a dictionary."""
494
+ base = {
495
+ 'modifier': self.modifier.to_dict(),
496
+ 'type': 'Trans',
497
+ 'identifier': self.identifier,
498
+ 'r_reflectance': self.r_reflectance,
499
+ 'g_reflectance': self.g_reflectance,
500
+ 'b_reflectance': self.b_reflectance,
501
+ 'specularity': self.specularity,
502
+ 'roughness': self.roughness,
503
+ 'transmitted_diff': self.transmitted_diff,
504
+ 'transmitted_spec': self.transmitted_spec,
505
+ 'dependencies': [dp.to_dict() for dp in self.dependencies]
506
+ }
507
+ if self._display_name is not None:
508
+ base['display_name'] = self.display_name
509
+ return base
510
+
511
+ def __copy__(self):
512
+ mod, depend = self._dup_mod_and_depend()
513
+ new_obj = self.__class__(
514
+ self.identifier, self.r_reflectance, self.g_reflectance, self.b_reflectance,
515
+ self.specularity, self.roughness, self.transmitted_diff,
516
+ self.transmitted_spec, mod, depend)
517
+ new_obj._display_name = self._display_name
518
+ return new_obj
@@ -0,0 +1,49 @@
1
+ """Radiance Trans2 Material.
2
+
3
+ http://radsite.lbl.gov/radiance/refer/ray.html#Trans2
4
+ """
5
+ from .materialbase import Material
6
+
7
+
8
+ # TODO: Implement the class. It's currently only a generic Radiance Primitive
9
+ class Trans2(Material):
10
+ """Radiance Trans2 Material.
11
+
12
+ Trans2 is the anisotropic version of trans. The string arguments are the same as for
13
+ plastic2, and the real arguments are the same as for trans but with an additional
14
+ roughness value.
15
+
16
+ .. code-block:: shell
17
+
18
+ mod trans2 id
19
+ 4+ ux uy uz funcfile transform
20
+ 0
21
+ 8 red green blue spec urough vrough trans tspec
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,50 @@
1
+ """Radiance Transdata Material.
2
+
3
+ http://radsite.lbl.gov/radiance/refer/ray.html#Transdata
4
+ """
5
+ from .materialbase import Material
6
+
7
+
8
+ # TODO: Implement the class. It's currently only a generic Radiance Primitive
9
+ class Transdata(Material):
10
+ """Radiance Transdata Material.
11
+
12
+ Transdata is like plasdata but the specification includes transmittance as well as
13
+ reflectance. The parameters are as follows.
14
+
15
+ .. code-block:: shell
16
+
17
+ mod transdata id
18
+ 3+n+
19
+ func datafile
20
+ funcfile x1 x2 .. xn transform
21
+ 0
22
+ 6+ red green blue rspec trans tspec A7 ..
23
+
24
+ Args:
25
+ identifier: Text string for a unique Material ID. Must not contain spaces
26
+ or special characters. This will be used to identify the object across
27
+ a model and in the exported Radiance files.
28
+ modifier: Modifier. It can be primitive, mixture, texture or pattern.
29
+ (Default: None).
30
+ values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
31
+ refer to a line number in the radiance primitive definitions and the
32
+ values in each array correspond to values occurring within each line.
33
+ is_opaque: A boolean to indicate whether this primitive is opaque.
34
+ dependencies: A list of primitives that this primitive depends on. This
35
+ argument is only useful for defining advanced primitives that are
36
+ defined based on other primitives. (Default: []).
37
+
38
+ Properties:
39
+ * identifier
40
+ * display_name
41
+ * values
42
+ * modifier
43
+ * dependencies
44
+ * is_modifier
45
+ * is_material
46
+ * is_opaque
47
+ """
48
+ __slots__ = ()
49
+
50
+ pass
@@ -0,0 +1,53 @@
1
+ """Radiance Transfunc Material.
2
+
3
+ http://radsite.lbl.gov/radiance/refer/ray.html#Transfunc
4
+ """
5
+ from .materialbase import Material
6
+
7
+
8
+ # TODO: Implement the class. It's currently only a generic Radiance Primitive
9
+ class Transfunc(Material):
10
+ """Radiance Transfunc Material.
11
+
12
+ Transfunc is similar to plasfunc but with an arbitrary bidirectional transmittance
13
+ distribution as well as a reflectance distribution. Both reflectance and
14
+ transmittance are specified with the same function.
15
+
16
+ .. code-block:: shell
17
+
18
+ mod transfunc id
19
+ 2+ brtd funcfile transform
20
+ 0
21
+ 6+ red green blue rspec trans tspec A7 ..
22
+
23
+ Where trans is the total light transmitted and tspec is the non-Lambertian fraction
24
+ of transmitted light. The function brtd should integrate to 1 over each projected
25
+ hemisphere.
26
+
27
+ Args:
28
+ identifier: Text string for a unique Material ID. Must not contain spaces
29
+ or special characters. This will be used to identify the object across
30
+ a model and in the exported Radiance files.
31
+ modifier: Modifier. It can be primitive, mixture, texture or pattern.
32
+ (Default: None).
33
+ values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
34
+ refer to a line number in the radiance primitive definitions and the
35
+ values in each array correspond to values occurring within each line.
36
+ is_opaque: A boolean to indicate whether this primitive is opaque.
37
+ dependencies: A list of primitives that this primitive depends on. This
38
+ argument is only useful for defining advanced primitives that are
39
+ defined based on other primitives. (Default: []).
40
+
41
+ Properties:
42
+ * identifier
43
+ * display_name
44
+ * values
45
+ * modifier
46
+ * dependencies
47
+ * is_modifier
48
+ * is_material
49
+ * is_opaque
50
+ """
51
+ __slots__ = ()
52
+
53
+ pass
@@ -0,0 +1,6 @@
1
+ """Radiance Mixtures."""
2
+
3
+ from .mixdata import Mixdata
4
+ from .mixfunc import Mixfunc
5
+ from .mixpict import Mixpict
6
+ from .mixtext import Mixtext