Upload app.py
Browse files
app.py
CHANGED
@@ -142,9 +142,9 @@ with st.sidebar:
|
|
142 |
"Acoustic Treatment", "Final RT60 Compliance Check", "Intelligibility Noise Reduction"]:
|
143 |
st.button(tab, on_click=switch_tab, args=(tab,))
|
144 |
|
145 |
-
# Display content based on selected tab in the main window
|
146 |
-
st.title("Building Acoustics Analysis Tool")
|
147 |
-
st.header(st.session_state.current_tab)
|
148 |
|
149 |
def display_instructions():
|
150 |
import pandas as pd
|
@@ -621,15 +621,16 @@ def display_final_rt60_compliance_check():
|
|
621 |
st.warning("Please complete the previous steps before proceeding to the final RT60 compliance check.")
|
622 |
|
623 |
def display_intelligibility_noise_reduction():
|
624 |
-
st.write('''On this tab, you will calculate noise reduction using existing and new materials sound
|
625 |
-
coefficients and surface areas that were provided for
|
626 |
-
have copied to this tab for ease of reference. Note that
|
627 |
or deleting existing rows. Your can also directly edit the current new materials data information. All updates
|
628 |
-
will lead to updating relevant
|
629 |
-
|
630 |
same room''')
|
631 |
|
632 |
st.write("#### Upload current sound pressure levels")
|
|
|
633 |
sound_pressure_file = st.file_uploader("Upload CSV or Excel file for current sound pressure levels",
|
634 |
type=['csv', 'xlsx'],
|
635 |
help='The file should have columns for frequencies 125, 250, 500, 1000, 2000, and 4000, and the first column should contain the names of the locations where sound pressure was measured.')
|
@@ -648,7 +649,7 @@ def display_intelligibility_noise_reduction():
|
|
648 |
st.dataframe(st.session_state.df_sound_pressure, use_container_width=True)
|
649 |
|
650 |
st.write("#### Calculated current room sound absorption")
|
651 |
-
st.info('''The data below a duplicate of the current room sound absorption calculated for reverberation time
|
652 |
analysis. It is provided here as a reminder of the existing materials in the room and their calculated sound
|
653 |
absorptions.''')
|
654 |
if 'df_current_absorption' in st.session_state:
|
@@ -657,10 +658,10 @@ def display_intelligibility_noise_reduction():
|
|
657 |
st.write("#### Editable new materials data")
|
658 |
st.info('''The editable table below is a duplicate of the new materials data from reverberation time
|
659 |
analysis. You can edit this table by adding new rows, deleting existing rows, or directly editing any
|
660 |
-
information in the table. Click check box on the
|
661 |
top or bottom to add new rows. Note that any changes made here will automatically updated all the calculations
|
662 |
on this tab and also update the new materials data for reverberation time and other reverberation time
|
663 |
-
calculations that
|
664 |
|
665 |
if 'df_new_materials' in st.session_state:
|
666 |
edited_df = st.data_editor(st.session_state.df_new_materials, num_rows="dynamic")
|
@@ -704,10 +705,12 @@ def display_intelligibility_noise_reduction():
|
|
704 |
if current_total_absorption > 0:
|
705 |
noise_reduction = 10 * np.log10(new_total_absorption / current_total_absorption)
|
706 |
st.session_state.noise_reduction = noise_reduction
|
707 |
-
st.write(f"
|
708 |
st.info('''The above noise reduction value is calculated total sound absorption for existing and new
|
709 |
material above. The noise reduction formula is shown below:\n
|
710 |
-
10 * Log10(new materials total absorption/existing materials total absorption)
|
|
|
|
|
711 |
else:
|
712 |
st.error("Current total absorption is zero, which is not possible. Please check your data.")
|
713 |
|
|
|
142 |
"Acoustic Treatment", "Final RT60 Compliance Check", "Intelligibility Noise Reduction"]:
|
143 |
st.button(tab, on_click=switch_tab, args=(tab,))
|
144 |
|
145 |
+
# # Display content based on selected tab in the main window
|
146 |
+
# st.title("Building Acoustics Analysis Tool")
|
147 |
+
# st.header(st.session_state.current_tab)
|
148 |
|
149 |
def display_instructions():
|
150 |
import pandas as pd
|
|
|
621 |
st.warning("Please complete the previous steps before proceeding to the final RT60 compliance check.")
|
622 |
|
623 |
def display_intelligibility_noise_reduction():
|
624 |
+
st.write('''On this tab, you will calculate noise reduction using existing and new materials sound absorption
|
625 |
+
coefficients and surface areas that were provided for reverberation time analysis. The relevant data
|
626 |
+
have copied to this tab for ease of reference. Note that you can update the new materials data by adding new rows
|
627 |
or deleting existing rows. Your can also directly edit the current new materials data information. All updates
|
628 |
+
will lead to updating relevant processes on this tab. Note that changes made to the new materials data
|
629 |
+
on this tab will also update the new materials data for reverberation time given that the analysis is for the
|
630 |
same room''')
|
631 |
|
632 |
st.write("#### Upload current sound pressure levels")
|
633 |
+
st.warning("##### Upload current sound pressure level data to complete the analysis on this tab")
|
634 |
sound_pressure_file = st.file_uploader("Upload CSV or Excel file for current sound pressure levels",
|
635 |
type=['csv', 'xlsx'],
|
636 |
help='The file should have columns for frequencies 125, 250, 500, 1000, 2000, and 4000, and the first column should contain the names of the locations where sound pressure was measured.')
|
|
|
649 |
st.dataframe(st.session_state.df_sound_pressure, use_container_width=True)
|
650 |
|
651 |
st.write("#### Calculated current room sound absorption")
|
652 |
+
st.info('''The data below is a duplicate of the current room sound absorption calculated for reverberation time
|
653 |
analysis. It is provided here as a reminder of the existing materials in the room and their calculated sound
|
654 |
absorptions.''')
|
655 |
if 'df_current_absorption' in st.session_state:
|
|
|
658 |
st.write("#### Editable new materials data")
|
659 |
st.info('''The editable table below is a duplicate of the new materials data from reverberation time
|
660 |
analysis. You can edit this table by adding new rows, deleting existing rows, or directly editing any
|
661 |
+
information in the table. Click check box on the left to delete a row. Hover over the table and click + at the
|
662 |
top or bottom to add new rows. Note that any changes made here will automatically updated all the calculations
|
663 |
on this tab and also update the new materials data for reverberation time and other reverberation time
|
664 |
+
calculations that are connected to that data.''')
|
665 |
|
666 |
if 'df_new_materials' in st.session_state:
|
667 |
edited_df = st.data_editor(st.session_state.df_new_materials, num_rows="dynamic")
|
|
|
705 |
if current_total_absorption > 0:
|
706 |
noise_reduction = 10 * np.log10(new_total_absorption / current_total_absorption)
|
707 |
st.session_state.noise_reduction = noise_reduction
|
708 |
+
st.write(f"##### Noise Reduction: {noise_reduction:.2f} dB")
|
709 |
st.info('''The above noise reduction value is calculated total sound absorption for existing and new
|
710 |
material above. The noise reduction formula is shown below:\n
|
711 |
+
NR = 10 * Log10(new materials total absorption/existing materials total absorption)
|
712 |
+
|
713 |
+
The above formula is the same as 10 * Log10(S alpha after/S alpha before''')
|
714 |
else:
|
715 |
st.error("Current total absorption is zero, which is not possible. Please check your data.")
|
716 |
|