From 6386c05ee648e78760fe37a3f10a88d8d1f22754 Mon Sep 17 00:00:00 2001 From: Mostapha Date: Fri, 19 Feb 2021 18:55:38 -0500 Subject: [PATCH] feat: update to pollination-honeybee-radiance:0.5.0 - added input to filter sensor grids - update tasks to work with the new functions - added support for models with sensor grid groups --- pollination/daylight_factor/_raytracing.py | 7 +++++-- pollination/daylight_factor/entry.py | 21 ++++++++++++++------- requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pollination/daylight_factor/_raytracing.py b/pollination/daylight_factor/_raytracing.py index ab50372..4c37a71 100644 --- a/pollination/daylight_factor/_raytracing.py +++ b/pollination/daylight_factor/_raytracing.py @@ -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( @@ -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( diff --git a/pollination/daylight_factor/entry.py b/pollination/daylight_factor/entry.py index 457dc46..9185519 100644 --- a/pollination/daylight_factor/entry.py +++ b/pollination/daylight_factor/entry.py @@ -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 @@ -28,6 +27,11 @@ 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'], @@ -35,13 +39,16 @@ class DaylightFactorEntryPoint(DAG): ) @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'}, @@ -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. diff --git a/requirements.txt b/requirements.txt index 3234654..5a8797e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pollination-honeybee-radiance==0.4.7 +pollination-honeybee-radiance==0.5.0 pollination-alias==0.2.1 diff --git a/setup.py b/setup.py index 6593c49..6071ce2 100644 --- a/setup.py +++ b/setup.py @@ -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