src package¶
Submodules¶
src.constants module¶
src.convert_make_probs_method module¶
- src.convert_make_probs_method.convert_make_probs_method(make_probs_method)¶
Converts provided make_probs method from display string to functional string.
src.init_mitsuba module¶
- src.init_mitsuba.init_custom_bsdfs()¶
Initializes Custom BSDFs for Mitsuba 3.
- src.init_mitsuba.init_metalog_bsdfs()¶
Initializes M-BSDFs for Mitsuba 3.
- src.init_mitsuba.init_mitsuba()¶
Initializes Mitsuba 3 related components for later use.
src.make_metalogs_plot_div module¶
- src.make_metalogs_plot_div.make_metalogs_plot_div(processed_data, id_graph_marginals: str = 'marginals', id_graph_cond_dists: str = 'cond_dists', id_graph_pdfs: str = 'pdfs', id_graph_histograms: str = 'hists', id_graph_orig_gen_samples: str = 'samples', make_probs_method: str = 'chebyshev')¶
Prepares various figures (dbc.Graph) and puts them into a html.Div component displaying the metalogs from the provided processed_data.
- src.make_metalogs_plot_div.make_terms_column(id, label)¶
Makes a dbc.Col with a terms slider.
src.plotting module¶
- src.plotting.make_colorbar_dict(x_domain, y_domain, title)¶
Makes a dictionary for a colorbar.
- src.plotting.plot_bivariate_pdfs(data_pdf, marginal_samples_cpu, conditional_samples_cpu, marginal_label_latex, cond_label_latex, metalog_pdf, estimated_metalog_pdf)¶
Prepares a multi-column Figure with Scattergl graphs containing bivariate metalog PDFs.
- src.plotting.plot_cond_metalogs(metalog_coeffs: Tensor, bounds: tuple[float, float] | None = None, metalog_inverse_cdf: Tensor | None = None, fig_suptitle: str = 'Marginal-Conditionals', orig_samples: Tensor = None)¶
Prepares a multi-column Figure with various graphs containing conditional metalogs data.
- src.plotting.plot_histograms(marginal_samples_cpu, conditional_samples_cpu, metalog_marginal_label, metalog_conditional_label, gen_samples_cpu, data_hist, gen_hist, n_bins_marginal, n_bins_cond)¶
Prepares a multi-column Figure with Histogram and Heatmap from the provided data.
- src.plotting.plot_marginal_metalogs(samples: Tensor, metalog_resolution: int, label: str, x_lim: list, metalog_coefficients: Tensor, accuracy: Tensor, num_terms: Tensor, metalog_term: int, bounds: tuple[float, float] = None, y_lim_pdf: list = None, probs: Tensor = None, orig_samples: Tensor = None)¶
Prepares a multi-column Figure with various graphs containing marginal metalogs data.
- src.plotting.plot_measured_orig_generated_samples(marginal_samples_cpus: list, conditional_samples_cpus: list, gen_samples_cpus: list, phi_incident_angles: list, theta_incident_angles: list)¶
Prepares a multi-column Figure with various graphs containing samples from the measured Mitsuba BSDF and generated distribution.
- src.plotting.plot_orig_generated_samples(marginal_samples_cpu, conditional_samples_cpu, metalog_samples_3d, gen_samples_cpu, marginal_label_latex, cond_label_latex, orig_samples_3d)¶
Prepares a multi-column Figure with various graphs containing samples from the original and generated distribution.
src.process_metalogs_dict module¶
- src.process_metalogs_dict.process_metalogs_dict(dict_of_tensors, metalog_term=3)¶
Process produced metalogs dictionary for later use.
- Returns:
Values refer to processed metalog data.
- Return type:
dict
src.render_tab module¶
- src.render_tab.load_mitsuba_scene(scene_file_store)¶
If anything fails, returns (None, “some error string”). If it succeeds, returns (scene_object, None).
- src.render_tab.make_column_content(graph_id, scene, error_msg, label, spp)¶
If there was an error loading the scene, return a styled <p> with the error. Otherwise, return a dcc.Graph containing a random 256x256 image.
- src.render_tab.make_content()¶
Creates the content for the Render tab.
- Returns:
Content of the Render tab.
- Return type:
a list of or a singular dash component, string or number; optional
- src.render_tab.make_diff_image_column_content(graph_id, img_1, img_2)¶
Makes a dcc.Graph if both images are available and have the same resolution. Otherwise display a message in an html.P component.
- src.render_tab.make_diff_image_figure(img_1, img_2)¶
Compute RMSE between img_1 and img_2, then return a Plotly figure containing the absolute difference image in grayscale.
- src.render_tab.make_figure(image, title)¶
Makes it as a Plotly Figure from the provided image.
- src.render_tab.make_render_parameters_div()¶
Makes a html.Div component containing various parameters components.
- src.render_tab.make_scene_file_upload_col(id, label)¶
Makes a dbc.Col for uploading scene files.
- src.render_tab.make_spp_column(id, label)¶
Makes a dbc.Col with a samples per pixel slider.
- src.render_tab.update_diff_image_graph(switch_on)¶
Updates the light/dark mode of the dcc.Graph(id_diff_image_graph).
- src.render_tab.update_first_scene_graph(switch_on)¶
Updates the light/dark mode of the dcc.Graph(id_first_scene_graph).
- src.render_tab.update_plots(scene_file_store, scene_file_store_2, spp)¶
Called whenever either store is updated or the spp value has changed.
First column: if the uploaded first scene is valid then the rendered image, otherwise error
Second column: if the uploaded second scene is valid then the rendered image, otherwise error
Third column: The difference image, if first two images are available.
- src.render_tab.update_scene_file_store(contents, filename)¶
Updates the contents and filename of the dcc.Store(id_scene_file_store) component, whenever the dcc.Upload(id_scene_file_upload) is triggered.
- src.render_tab.update_scene_file_store_2(contents, filename)¶
Updates the contents and filename of the dcc.Store(id_scene_file_store_2) component, whenever the dcc.Upload(id_scene_file_upload_2) is triggered.
- src.render_tab.update_second_scene_graph(switch_on)¶
Updates the light/dark mode of the dcc.Graph(id_second_scene_graph).
src.update_figure_template module¶
- src.update_figure_template.update_figure_template(switch_on)¶
- Returns:
Provides a dash.Patch according to the selected dark/light template.
- Return type:
Patch
src.view_generate module¶
- src.view_generate.make_content()¶
Creates the content for the Generate Data tab.
- Returns:
Content of the Generate Data tab.
- Return type:
a list of or a singular dash component, string or number; optional
- src.view_generate.make_data_type_div()¶
Returns a html.Div with the data type Dropdown.
- src.view_generate.make_marginal_column(id, label)¶
Makes a dbc.Col with a marginal axis radio button.
- src.view_generate.make_max_num_terms_column(id, label)¶
Makes a dbc.Col with a maximum number of terms slider.
- src.view_generate.make_metalog_parameter_divs()¶
Makes a html.Div with the content of the metalog parameters.
- src.view_generate.make_modal_container(abs_output_dir)¶
Returns a dbc.Container with the content of a Modal.
- src.view_generate.make_number_of_samples_column(id, label)¶
Makes a dbc.Col with a number of samples slider.
- src.view_generate.make_probs_div(id, label)¶
Makes a dbc.Col with a make_probs method slider.
- src.view_generate.make_regularization_column(id, label)¶
Makes a dbc.Col with a regularization slider.
- src.view_generate.make_resolution_column(id, label)¶
Makes a dbc.Col with a resolution slider.
- src.view_generate.make_save_distr_div()¶
Makes a html.Div component for save distribution button.
- Returns:
A component for save distribution button.
- Return type:
html.Div
- src.view_generate.update_data_type_visibility(data_type)¶
Updates the visibility of the html.Div data type parameters.
- src.view_generate.update_plots(data_type, n_samples, regularization_marginal, regularization_conditional, resolution_marginal, axis_marginal, max_num_terms, metalog_term, microfacet_type, alpha_u, alpha_v, make_probs_method, save_btn_nclicks, phi_incident_angles, epfl_measured_picked_slice, metalog_measured_tmp_filename, epfl_measured_view, bsdf_data)¶
Updates Generate Data Tab figures according to the selected parameters.
- Parameters:
data_type (str) – Selected data type.
n_samples (int) – Selected number of samples.
regularization_marginal (float) – Selected regularization term for marginal.
regularization_conditional (float) – Selected regularization term for conditional.
resolution_marginal (int) – Selected resolution term.
axis_marginal (str) – Selected marginal parameter (e.g., phi).
max_num_terms (int) – Selected maximum available terms.
metalog_term (int) – Selected metalog term.
microfacet_type (str) – Selected microfacet term.
alpha_u (float) – Selected roughness value for the tangent direction.
alpha_v (float) – Selected roughness value for the bitangent direction.
make_probs_method (str) – Selected CDF construction method.
save_btn_nclicks – Number of clicks of the save button.
phi_incident_angles (list) – List of selected incident direction angles for phi_i.
epfl_measured_picked_slice (str) – Selected measured BSDF slice label (e.g., phi_i_0.0…).
metalog_measured_tmp_filename (dict) – A dictionary containing the filename of the temporarily saved metalogs for
BSDF. (the measured)
epfl_measured_view (str) – Selected measured BSDF view.
bsdf_data (dict) – A dictionary containing the content and filename of the uploaded BSDF.
- Returns:
is_open, dbc.Modal: Updated figures for html.Div(id_view_generate_plots), is_open status for dbc.Modal(id=id_modal_on_save_distr) and content of dbc.Modal(id=id_modal_on_save_distr).
- Return type:
html.Div, dbc.Modal
src.view_generate_analytic_bsdf module¶
- src.view_generate_analytic_bsdf.get_output_dir(data_type, axis_marginal, microfacet_type, alpha_u, alpha_v)¶
Returns an output directory (str) from the provided parameters.
- src.view_generate_analytic_bsdf.make_alpha_column(id, label)¶
Makes a dbc.Col with a microfacet roughness (alpha) slider.
- src.view_generate_analytic_bsdf.make_microfacet_parameter_divs()¶
Makes a html.Div component with various microfacet parameter components.
- src.view_generate_analytic_bsdf.make_microfacet_type_column(id, label)¶
Makes a dbc.Col with a microfacet type dropdown.
- src.view_generate_analytic_bsdf.prepare_analytic_bsdf_data(regularization_marginal, regularization_conditional, resolution_marginal, axis_marginal, max_num_terms, metalog_term, sRec, make_probs_method, device)¶
Makes bivariate metalog data from the provided parameters and returns a processed version for later use.
- src.view_generate_analytic_bsdf.update_microfacet_figures(switch_on, data_type)¶
Updates the light/dark mode of the microfacet dbc.Graph’s.
src.view_generate_epfl_measured module¶
- src.view_generate_epfl_measured.init_metalog_measured_material(contents, axis_marginal, is_bounded)¶
Tries to initialize an MetalogEPFLMeasuredMaterial instance from the provided contents. In success, returns the instance, otherwise None.
- src.view_generate_epfl_measured.make_epfl_measured_parameter_divs()¶
Makes an html.Div component containing various parameter components for EPFL measured BSDFs.
- src.view_generate_epfl_measured.make_measured_metalog_plot_div(metalogEPFLBSDF: MetalogEPFLMeasuredMaterial, metalog_measured: dict, phi_incident_angles: list, epfl_measured_view: str, epfl_measured_picked_slice: str | None = None, make_probs_method: str | None = None, metalog_term: int = 3)¶
Makes various dbc.Graph contents according to the selected epfl_measured_view.
- src.view_generate_epfl_measured.make_measured_overview_plots(metalogEPFLBSDF, metalog_measured, phi_incident_angles, metalog_term)¶
Makes an html.Div component containing multi-column figures that gives an overview of the measured metalog BSDF.
- src.view_generate_epfl_measured.make_metalog_measured_material(data_type, n_samples, regularization_marginal, regularization_conditional, resolution_marginal, axis_marginal, max_num_terms, tmp_bsdf_store, bsdf_data, metalog_term, make_probs_method, phi_incident_angles, metalog_measured_tmp_filename)¶
Makes a measured metalog material from the provided parameters and temporarily stores it in a file.
- Returns:
A dictionary with the key filename with the value of the temporary filename containing the measured metalog material.
- Return type:
dict
- src.view_generate_epfl_measured.update_measured_epfl_overview_figures(switch_on, data_type, view_type)¶
Updates the light/dark mode of the dcc.Graph(id_view_generate_measured_metalog_bsdf_graphs).
- src.view_generate_epfl_measured.update_measured_epfl_slice_figures(switch_on, data_type, view_type)¶
Updates the light/dark mode of the selected measured metalog dcc.Graph’s.
- src.view_generate_epfl_measured.update_measured_overview_slice_options(bsdf_data, view_type, axis_marginal)¶
After the user loads a BSDF file (stored in bsdf_store), update the dropdown options (and optionally the default value).
- src.view_generate_epfl_measured.update_measured_view_visibility(view_type)¶
Updates the visibility of the html.Div according to the selected view_type.
- src.view_generate_epfl_measured.update_output(contents, filename)¶
Updates the data of dbc.Store(id_bsdf_store) whenever the contents of dcc.Upload(id_bsdf_upload) changes.
src.view_generated module¶
- src.view_generated.make_content()¶
Creates the content for the Explore Data tab.
- Returns:
Content of the Explore Data tab.
- Return type:
a list of or a singular dash component, string or number; optional
- src.view_generated.make_metalog_parameters_div()¶
Creates a html.Div for the metalog parameters.
- src.view_generated.parse_contents(contents, filename)¶
Parses contents of the provided contents and filename.
- Parameters:
contents – Content of the uploaded dcc.Upload component.
filename (str) – Filename of the uploaded dcc.Upload component.
- Returns:
True and the read torch.Tensor if the content from the provided file is read successfully. False and a zero tensor otherwise.
- Return type:
bool, torch.Tensor
- src.view_generated.update_figure_templates(switch_on)¶
Updates the light/dark mode of the figures, whenever dbc.Switch(id_color_mode_switch) value changes.
- src.view_generated.update_figures(metalog_term, stored_data)¶
Called whenever selected term slider value has changed.
- Returns:
Updated figures with the selected term.
- Return type:
plotly.graph_objs.Figure’s
- src.view_generated.update_output(contents, filename)¶
Updates the html.Div(id_output_data_upload) and dcc.Store(id_uploaded_data_store) components, whenever the content of the dcc.Upload(id_upload_data) changes.
- Parameters:
contents – Content of the uploaded dcc.Upload component.
filename (str) – Filename of the uploaded dcc.Upload component.
- Returns:
Updated html.Div(id_output_data_upload) and dcc.Store(id_uploaded_data_store) components.