honeybee_radiance_folder.folder module

Radiance folder structure module.

This module includes classes for writing and reading to / from a Radiance folder structure.

See https://github.com/ladybug-tools/radiance-folder-structure#radiance-folder-structure

class honeybee_radiance_folder.folder.ModelFolder(project_folder, model_folder='model', config_file=None)[source]

Bases: honeybee_radiance_folder.folder._Folder

Radiance Model folder.

Radiance Model folder includes all geometry and geometry metadata including modifiers. See Radiance folder structure repository for more information:

https://www.github.com/ladybug-tools/radiance-folder-structure

Parameters
  • project_folder (str) – Project folder as string. The folder will be created on write if it doesn’t exist already.

  • model_folder (str) – Model folder name (default: model).

  • config_file (str) – Optional config file to modify the default folder names. By default folder.cfg in honeybee-radiance-folder will be used.

└─model                  :: radiance model folder
    ├───aperture         :: static apertures description
    ├───aperture_group   :: apertures groups (AKA window groups) - optional
       └───interior     :: interior aperture groups - optional
    ├───bsdf             :: in-model BSDF files and transmittance matrix files
    ├───grid             :: sensor grids
    ├───ies              :: electric lights description
    ├───scene            :: static scene description
    ├───scene_dynamic    :: dynamic scene description - optional
       └───indoor       :: indoor dynamic scene description - optional
    └───view             :: indoor and outdoor views
aperture_files(black_out=False, rel_path=True)[source]

Return list of files for apertures.

This list includes both geometry and modifier files. This method will raise a ValueError if it cannot find a modifier file with the same name as the geometry file.

Parameters
  • black_out (str) – Set black_out to True for “isolated” studies for aperture groups.

  • rel_path (str) – Set rel_path to False for getting full path to files. By default the path is relative to study folder root.

aperture_folder(full=False)[source]

Aperture folder path.

Parameters

full – A boolean to weather the path should be a full path or a relative path (default: False).

Returns

Path to folder.

aperture_group_files_black(exclude=None, rel_path=False)[source]

Return list of files for black aperture groups.

Parameters
  • exclude – Identifier of aperture groups to exclude from the list of black aperture groups files. This input can be either a single aperture group identifier or a list of aperture group identifiers.

  • rel_path – Set rel_path to True for getting full path to files. By default the path is relative to study folder root.

aperture_group_folder(full=False, interior=False)[source]

Aperture group folder path.

Parameters
  • full – A boolean to note if the path should be a full path or a relative path (default: False).

  • interior – Set to True to get the path for interior aperture group folder.

Returns

Path to folder.

aperture_groups(interior=False, reload=False)[source]

List of apertures groups.

Parameters
  • interior (bool) – Boolean switch to return interior dynamic apertures.

  • reload (bool) – Dynamic geometries are loaded the first time this method is called. To reload the files set reload to True.

Returns

A list of dynamic apertures.

aperture_groups_states(full=False, interior=False)[source]

Return states information for aperture groups.

Arg:
full: A boolean to note if the path should be a full path or a relative path

(default: False).

interior: Set to True to get the states information for the interior aperture

groups.

bsdf_folder(full=False)[source]

BSDF folder path.

Parameters

full – A boolean to weather the path should be a full path or a relative path (default: False).

Returns

Path to folder.

combined_receivers(folder='receiver', auto_mtx_path=False)[source]

Write combined receiver files to folder.

This function writes a combined receiver file of the aperture groups for all grids in the folder. It will look for the light paths (aperture groups) of the grid and include only aperture groups that has a mtx file. This is intended for matrix-based daylight simulations, e.g. 3-phase, in which a view matrix is calculated. The combined receiver file allow multiple view matrices to be calculated at once, while still saving the result of each aperture group in a unique view matrix file.

Arg:

folder: A path of the target folder to write files to (default: ‘receiver’). auto_mtx_path: If set to True, then the path of the view matrices will be

specified automatically.

Returns

A dictionary containing grid identifiers as keys and the receiver rad files as values.

daylight_matrix_files(aperture, receiver=None)[source]

Files to be included in daylight matrix calculation for an aperture.

Target can be Sky or another aperture.

dynamic_scene(indoor=False, reload=False)[source]

List of dynamic non-aperture geometries.

Parameters
  • indoor (bool) – A boolean to indicate if indoor dynamic scene files should be returned (default: False).

  • reload (bool) – Dynamic geometries are loaded the first time this method is called. To reload the files set reload to True.

dynamic_scene_folder(full=False, indoor=False)[source]

Dynamic scene folder path.

Parameters
  • full – A boolean to note if the path should be a full path or a relative path (default: False).

  • indoor – Set to True to get the path for indoor dynamic scene folder.

Returns

Path to folder.

classmethod from_model_folder(model_folder, config_file=None)[source]

Use model folder instead of project folder.

Parameters
  • model_folder (str) – Model folder as string. The folder will be created on

  • if it doesn't exist already. (write) –

config_file (str): Optional config file to modify the default folder names. By

default folder.cfg in honeybee-radiance-folder will be used.

grid_data_all(info_from_model=False)[source]

This is an internal function that for a specified info_json, returns the consolidated grid data, that includes grid names,counts and identifiers, as a single dictionary.

Parameters
  • info_from_model – If set to True, data will be retrieved using

  • _model_grids_info.json

  • is written out after simulations.Else the (which) –

  • will be used. Defaults to False as the _info.json file is always (_info.json) –

  • to be present. (expected) –

Returns

A dictionary containing consolidated grid data for the entire folder.

grid_files(rel_path=True, group=None)[source]

Return list of grid files.

grid_folder(full=False)[source]

Sensor grids folder path.

Parameters

full – A boolean to weather the path should be a full path or a relative path (default: False).

Returns

Path to folder.

grid_info(is_model=False)[source]

Parse the appropriate grids_info file to return high level information about the sensor grids contained in the model folder.

Parameters

is_model – If set to True, the _model_grids_info.json, which is written out after simulations will be parsed. Else the _info.json will be parsed. Defaults to False as the _info.json file is always expected to be present.

Returns

The list containing information about sensor grids that are written to the

folder after model export.

grid_info_files(rel_path=True)[source]

Return list of grid information files.

grid_mapping(exclude_static=True, phase=2)[source]

List of grids for each light path. The light paths are grouped as two phase, three phase, and five phase. Aperture groups with a tmtx key in their states will be added to three phase unless the selected phase is 2. In this case the groups will be added to two phase. Five phase is a copy of three phase.

Arg:
exclude_static: A boolean to note whether static apertures are included. If

True a list of grids for static apertures will be created.

phase: An integer to note which multiphase study to generate the list of

grids for. Chose between 2, 3, and 5.

ies_folder(full=False)[source]

IES folder path.

Parameters

full – A boolean to weather the path should be a full path or a relative path (default: False).

Returns

Path to folder.

model_folder(full=False)[source]

Model root folder.

Parameters

full – A boolean to weather the path should be a full path or a relative path (default: False).

Returns

Path to folder.

octree_scene_mapping(exclude_static=True, phase=2, default_states=False)[source]

List of rad files for each state of aperture groups. These files can be used to create the octree for each specific state for dynamic daylight simulations.

Arg:
exclude_static: A boolean to note whether static apertures are included. If

True static apertures will be treated as a state, and a list of scene files for static apertures will be created.

phase: An integer to note which multiphase study to generate the list of

grids for. Chose between 2, 3, and 5.

default_states: A boolean to note whether to get the rad files for only

default states or all states of the aperture groups.

receiver_files(rel_path=True)[source]

Return list of receiver files.

receiver_folder(full=False)[source]

Receiver folder path.

Parameters

full – A boolean to weather the path should be a full path or a relative path (default: False).

Returns

Path to folder.

receiver_info_file(rel_path=True)[source]

Return the receiver information file.

scene_files(black_out=False, rel_path=True)[source]

Return list of files for scene.

Parameters
  • black_out (str) – Set black_out to True for direct sunlight studies.

  • rel_path (str) – Set rel_path to False for getting full path to files. By default the path is relative to study folder root.

scene_folder(full=False)[source]

Scene folder path.

Parameters

full – A boolean to weather the path should be a full path or a relative path (default: False).

Returns

Path to folder.

view_files(rel_path=True)[source]

Return list of view files.

view_folder(full=False)[source]

View folder path.

Parameters

full – A boolean to weather the path should be a full path or a relative path (default: False).

Returns

Path to folder.

view_info_files(rel_path=True)[source]

Return list of view information files.

view_matrix_files(aperture)[source]

Files to be included in view matrix calculation for an aperture.

write(folder_type=0, cfg=None, overwrite=False)[source]

Write an empty model folder.

Parameters
  • folder_type – An integer between -1-2. * -1: no grids or views * 0: grid-based * 1: view-based * 2: includes both views and grids

  • cfg (dict) – A dictionary with folder name as key and True or False as value. You can pre-defined from config module. Default is a grid-based ray-tracing folder.

  • overwrite (bool) – Set to True to overwrite the folder if it already exist.

Returns

path to folder.

CFG_KEYS = {'APERTURE': ['path', 'geo_pattern', 'mod_pattern', 'blk_pattern'], 'APERTURE-GROUP': ['path', 'states'], 'BSDF': ['path', 'bsdf_pattern'], 'DYNAMIC-SCENE': ['path', 'states'], 'GLOBAL': ['static_apertures'], 'GRID': ['path', 'grid_pattern', 'info_pattern'], 'IES': ['path', 'ies_pattern'], 'INDOOR-DYNAMIC-SCENE': ['path', 'states'], 'INTERIOR-APERTURE-GROUP': ['path', 'states'], 'SCENE': ['path', 'geo_pattern', 'mod_pattern', 'blk_pattern'], 'VIEW': ['path', 'view_pattern', 'info_pattern']}
CFG_KEYS_CHOICE = {'GRID': ['path', 'grid_pattern', 'info_pattern'], 'VIEW': ['path', 'view_pattern', 'info_pattern']}
CFG_KEYS_OPTIONAL = {'APERTURE-GROUP': ['path', 'states'], 'BSDF': ['path', 'bsdf_pattern'], 'DYNAMIC-SCENE': ['path', 'states'], 'IES': ['path', 'ies_pattern'], 'INDOOR-DYNAMIC-SCENE': ['path', 'states'], 'INTERIOR-APERTURE-GROUP': ['path', 'states']}
CFG_KEYS_REQUIRED = {'APERTURE': ['path', 'geo_pattern', 'mod_pattern', 'blk_pattern'], 'GLOBAL': ['static_apertures'], 'SCENE': ['path', 'geo_pattern', 'mod_pattern', 'blk_pattern']}
property folder

Return full path to project folder.

property has_aperture

Returns true if model has at least one aperture.

property has_aperture_group

Returns true if model has at least one aperture group.

property has_dynamic_scene

Return True if model has dynamic scene.

This check does not include aperture groups. Use has_aperture_group instead.