Skip to content

Commit

Permalink
feat: update to pollination-honeybee-radiance:0.5.0
Browse files Browse the repository at this point in the history
- added input to filter sensor grids
- update tasks to work with the new functions
- added support for models with sensor grid groups
  • Loading branch information
mostaphaRoudsari committed Feb 19, 2021
1 parent 2b32ae3 commit 6386c05
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
7 changes: 5 additions & 2 deletions pollination/daylight_factor/_raytracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DaylightFactorRayTracing(DAG):

radiance_parameters = Inputs.str(
description='The radiance parameters for ray tracing',
default='-ab 2'
default='-ab 2 -aa 0.1 -ad 2048 -ar 64'
)

octree_file = Inputs.file(
Expand Down Expand Up @@ -57,7 +57,10 @@ def ray_tracing(
grid=split_grid._outputs.output_folder, scene_file=octree_file
):
return [
{'from': RayTracingDaylightFactor()._outputs.result, 'to': '{{item.name}}.res'}
{
'from': RayTracingDaylightFactor()._outputs.result,
'to': '{{item.name}}.res'
}
]

@task(
Expand Down
21 changes: 14 additions & 7 deletions pollination/daylight_factor/entry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Dict, List
from pollination_dsl.dag import Inputs, DAG, task, Outputs
from dataclasses import dataclass
from pollination.honeybee_radiance.sky import GenSkyWithCertainIllum
Expand Down Expand Up @@ -28,20 +27,28 @@ class DaylightFactorEntryPoint(DAG):
default='-ab 2 -aa 0.1 -ad 2048 -ar 64'
)

sensor_grid = Inputs.str(
description='A grid name or a pattern to filter the sensor grids. By default '
'all the grids in HBJSON model will be exported.', default='*'
)

model = Inputs.file(
description='A Honeybee model in HBJSON file format.',
extensions=['json', 'hbjson'],
alias=hbjson_model_input
)

@task(template=GenSkyWithCertainIllum)
def generate_sky(self) -> List[Dict]:
def generate_sky(self):
return [
{'from': GenSkyWithCertainIllum()._outputs.sky, 'to': 'resources/100000_lux.sky'}
]
{
'from': GenSkyWithCertainIllum()._outputs.sky,
'to': 'resources/100000_lux.sky'
}
]

@task(template=CreateRadianceFolder)
def create_rad_folder(self, input_model=model) -> List[Dict]:
def create_rad_folder(self, input_model=model, sensor_grid=sensor_grid):
"""Translate the input model to a radiance folder."""
return [
{'from': CreateRadianceFolder()._outputs.model_folder, 'to': 'model'},
Expand Down Expand Up @@ -75,14 +82,14 @@ def create_octree(
needs=[create_rad_folder, create_octree],
loop=create_rad_folder._outputs.sensor_grids,
sub_folder='initial_results/{{item.name}}', # create a subfolder for each grid
sub_paths={'sensor_grid': 'grid/{{item.name}}.pts'} # sub_path for sensor_grid arg
sub_paths={'sensor_grid': 'grid/{{item.full_id}}.pts'} # sub_path for sensor_grid arg
)
def daylight_factor_ray_tracing(
self,
sensor_count=sensor_count,
radiance_parameters=radiance_parameters,
octree_file=create_octree._outputs.scene_file,
grid_name='{{item.name}}',
grid_name='{{item.full_id}}',
sensor_grid=create_rad_folder._outputs.model_folder
):
# this task doesn't return a file for each loop.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pollination-honeybee-radiance==0.4.7
pollination-honeybee-radiance==0.5.0
pollination-alias==0.2.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# normal setuptool inputs
setuptools.setup(
name='pollination-daylight-factor', # will be used for package name unless it is overwritten using __queenbee__ info.
name='pollination-daylight-factor', # will be used for package name
author='ladybug-tools', # the owner account for this package - required if pushed to Pollination
author_email='info@ladybug.tools',
packages=setuptools.find_namespace_packages( # required - that's how pollination find the package
Expand Down

0 comments on commit 6386c05

Please sign in to comment.