honeybee_plus.radiance.resultcollection.database module¶
Database to save grid-based daylight simulation recipes.
- 
class honeybee_plus.radiance.resultcollection.database.Database(filepath='radout.db', remove_if_exist=False)[source]¶
- Bases: - object- Sqlite3 database for honeybee grid_based daylight simulation. - The database currently only supports grid-based simulations. - 
BASESOURCEID= 1000000¶
 - 
add_result_tables(recipe_id)[source]¶
- Add result tables to database. - Parameters
- recipe_id – Recipe id as indicated in honeybee_plus.radiance.recipe.id 
- Returns
- returns list of table names that are added to database. 
 
 - 
add_source(name, state)[source]¶
- Add a light source to database. - In + 3-phase studies light sources are window groups. In rest of studies sky is considered the light source and id 0 is reserved for sky. - Parameters
- name – Name of source. 
- state – Name of state. 
 
- Returns
- An intger indicates global id for this source. The gid is a 7 digit
- number. int(gid / 10^6) is the id of the source and gid % 10^6 is the id for the state. 
 
- Return type
- gid 
 
 - 
property db_filepath¶
- Get path to database. 
 - 
classmethod from_analysis_recipe(analysis_recipe, filepath='radout.db')[source]¶
- Initiate a database for a daylighting recipe. 
 - 
property isDatabase¶
- Return True for database object. 
 - 
is_column(table_name, column_name)[source]¶
- Check if a column is available in a table in this database. 
 - 
property last_grid_id¶
- Get id for the last grid. 
 - 
property last_source_id¶
- Get id for last source. - Id is an intger indicates global id for this source. The gid is a 7 digit number. int(gid / 10^6) is the id of the source and gid % 10^6 is the id for the state. 
 - 
load_daylight_factor_results(filepath, divide_by=1000, source_mapping=None)[source]¶
- Load daylight factor results. 
 - 
load_dc_result_from_file(filepath, table_name, column_name='value', source='sky', state='default', moys=None, header=True)[source]¶
- Load Radiance results file to database. - The script assumes that each row represents an analysis point and number of coulmns is the number of timesteps. - Parameters
- res_type – 0 > sky_total, 1 > sky_direct, 2 > sun, 3 > final result 
- mode – 0 for “Insert” and 1 is for “Update”. Use 0 only the first time after creating the table. 
 
 
 - 
load_matrix_form_file(mtx_file, table_name)[source]¶
- Load Radiance matrix file to database. - The script assumes that each row represents an analysis point and number of coulmns is the number of sky patches. 
 - 
load_point_in_time_illuminance_results(filepath, source_mapping=None)[source]¶
- Load daylight factor results. 
 - 
load_point_in_time_results(filepath, table_name, divide_by, source_mapping=None, integer=True)[source]¶
- Generic method to load results from a result file. 
 - 
load_two_phase_results_final_from_folder(folder, moys=None, source_mapping=None, header=True)[source]¶
- Load only final results from daylight coefficient studies. - Parameters
- folder – Path to result folder. 
- moys – List of minutes of the year. Default is an hourly annual study. 
- source_mapping – A dictionary that includes sources and their states. Keys are source names and values are list of states. If source_mapping is not provided this method will sort the states based on name. 
 
 
 - 
load_two_phase_results_final_sun_from_folder(folder, moys=None, source_mapping=None)[source]¶
- Load final and sun results from folder. - Parameters
- folder – Path to result folder. 
- moys – List of minutes of the year. Default is an hourly annual study. 
- source_mapping – A dictionary that includes sources and their states. Keys are source names and values are list of states. If source_mapping is not provided this method will sort the states based on name. 
 
 
 - 
load_two_phase_results_from_folder(folder, moys=None, source_mapping=None)[source]¶
- Load all the results from daylight coefficient studies. - This method loads all the results including sun, direct, total an final results. For uploading only the final results use load_final_dc_results_from_folder method. - This method looks for files with .ill extensions. The file should be named as <data-type>..<window-group-name>..<state-name>.ill for instance total..north_facing..default.ill includes the ‘total’ values from ‘north_facing’ window group at ‘default’ state. - Parameters
- folder – Path to result folder. 
- moys – List of minutes of the year. Default is an hourly annual study. 
- source_mapping – A dictionary that includes sources and their states. Keys are source names and values are list of states. If source_mapping is not provided this method will sort the states based on name. 
 
 
 - 
property point_count¶
- Returns a tuple of number of points for Analysis Grids. - Values are sorted by grid_id. 
 - 
property source_ids¶
- Get list of source ids. 
 - 
property source_mapper¶
- Returna dictionary that maps src_id and state_id to global id. - {src_id: {state_id: id}, …} 
 - 
property sources¶
- Get light sources as a dictionary. - source_name..state is the key and id is the value. 
 - 
property sources_distinct¶
- Get unique name of light sources as a tuple. - Names are sorted based on id. 
 - 
property tables¶
- Get list of tables. 
 
-