Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,660 changes: 1,537 additions & 123 deletions PV-tool_TD.ipynb

Large diffs are not rendered by default.

14,177 changes: 1,189 additions & 12,988 deletions PV_tool0.5.ipynb

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ dbase.export_dbase_to_template(export_dir="pad/naar/exportlocatie")
```

### Stap 2: Analyse van geotechnische parameters
In deze stap worden op basis van de opgegeven data gedraineerde parameters bepaald. De analyse vindt plaats op de
opgegeven verzameling(en) (investigation_groups). Voor de analyse wordt een rekpercentage (effective_stress) gehanteerd. Voor de analyse op de TXT-proeven is er keuze
tussen een analyse bij 2%, 5%, 15%, pieksterkte en eindsterkte. Voor de DSS-analyse is keuze tussen 2%, 5%, 10%, 15%,
20%, eindsterkte of pieksterkte.

#### Stap 2.1: Analyse van gedraineerde parameters (C-phi)
De C-phi analyse bepaalt cohesie en hoek van inwendige wrijving uit triaxiaal- of DSS-proeven.
Expand Down Expand Up @@ -123,6 +127,13 @@ analyse.save_to_pdf(path='path/to/export_location')

#### Stap 2.2: Analyse van ongedraineerde parameters (SHANSEP)
De SHANSEP analyse bepaalt ongedraineerde schuifsterkteparameters op basis van de consolidatiegeschiedenis.
In deze stap worden op basis van de opgegeven data ongedraineerde parameters bepaald volgens de methode vastgelegd in
de schematiseringshandleiding macrostabiliteit. De analyse vindt plaats op de
opgegeven verzameling(en) (investigation_groups).

Voor de analyse wordt een rekpercentage (effective_stress) gehanteerd. Voor de analyse op de TXT-proeven is er keuze
tussen een analyse bij 2%, 5%, 15%, pieksterkte en eindsterkte. Voor de DSS-analyse is keuze tussen 2%, 5%, 10%, 15%,
20%, eindsterkte of pieksterkte.

```python
from pv_tool.shansep_analysis.shansep_analysis import SHANSEP
Expand Down Expand Up @@ -195,13 +206,6 @@ analyse.show_figure_sv_su_sutabel()
analyse.save_to_pdf(path='path/to/export_location')
```

- C-phi Analyse (cohesie en hoek van inwendige wrijving):
- Analyse van triaxiaalproeven (TXT)
- Analyse van Direct Simple Shear proeven (DSS)
- Keuze van rekpercentages: 2%, 5%, 10%, 15%, 20%, eindsterkte of pieksterkte
- Bepaling van verwachtingswaarde, karakteristieke waarde, en rekenwaarde
- Visualisatie van spanningspaden en Mohr-cirkels
- Export naar PDF en Excel

## Functionaliteiten

Expand Down
Binary file added Template_PVtool5_0.xlsx
Binary file not shown.
Binary file added dist/pv_tool-0.2.9-py3-none-any.whl
Binary file not shown.
Binary file added dist/pv_tool-0.2.9.tar.gz
Binary file not shown.
Binary file added dist/pv_tool-0.3.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/pv_tool-0.3.0.tar.gz
Binary file not shown.
3,885 changes: 0 additions & 3,885 deletions output_plot.html

This file was deleted.

10 changes: 5 additions & 5 deletions pv_tool/cphi_analysis/c_phi_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def save_fig_html(self, path: str, export_name: Optional[str] = None):
Naam van het HTML-bestand
"""
if export_name is None:
export_name = f"c-phi_analyse_{self.investigation_groups[0].value.replace(' ', '_')}.html"
export_name = f"c-phi_analyse_{self.investigation_groups[0].replace(' ', '_')}.html"
file_path = Path(path) / export_name
self.figure.write_html(file_path)
print(f"figuur opgeslagen als HTML: {file_path}")
Expand Down Expand Up @@ -631,10 +631,10 @@ def add_results_to_template(self, path, export_name=None):
'PV_RESULTAAT_ID': f"{self.investigation_groups[0]}_{self.effective_stress}_"
f"{self.analysis_type.split('_')[0]}_{self.analysis_type.split('_')[1]}",
'PV_TYPEVERZAMELING': self.alpha,
'PV_A1_COH_GEM': round(self.gem_a1, 3) if self.gem_a1 is not None else None,
'PV_A2_TAN_PHI_GEM': round(self.gem_a2, 3) if self.gem_a2 is not None else None,
'PV_A1_COH_KAR': round(self.kar_a1, 3) if self.kar_a1 is not None else None,
'PV_A2_TAN_PHI_KAR': round(self.kar_a2, 3) if self.kar_a2 is not None else None,
'PV_A1_COH_GEM': round(self.gem_a1, 3) if self.gem_a1 is not None else None, # TODO: gaat deze dan wel goed?
'PV_A2_TAN_PHI_GEM': round(self.gem_a2, 3) if self.gem_a2 is not None else None, # TODO: welke waarde? gem_a2 of tan_phi_gem
'PV_A1_COH_KAR': round(self.kar_a1, 3) if self.kar_a1 is not None else None, # TODO: gaat deze dan wel goed?
'PV_A2_TAN_PHI_KAR': round(self.kar_a2, 3) if self.kar_a2 is not None else None, # TODO: zelfde geld hier met kar_a2 of tan_phi_kar

'PV_COH_GEM': (
round(self.c_gem, 3) if self.c_gem is not None and self.c_gem >= 0
Expand Down
75 changes: 46 additions & 29 deletions pv_tool/shansep_analysis/save_and_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

try:
from PIL import Image as PILImage

PIL_AVAILABLE = True
except ImportError:
PIL_AVAILABLE = False
Expand All @@ -24,8 +25,8 @@
from pv_tool.shansep_analysis.shansep_analysis import SHANSEP



def add_results_to_dbase(self: "SHANSEP", path: str, file_name: str = 'Template_PVtool5_0.xlsx'): #TODO deze wordt vervangen door add_results_to_template
def add_results_to_dbase(self: "SHANSEP", path: str,
file_name: str = 'Template_PVtool5_0.xlsx'): # TODO deze wordt vervangen door add_results_to_template
"""
Voegt de SHANSEP analyseresultaten toe aan de database Excel-bestand.

Expand Down Expand Up @@ -65,11 +66,13 @@ def add_results_to_dbase(self: "SHANSEP", path: str, file_name: str = 'Template_
'PV_ANALYSE': '_'.join(self.analysis_type.split('_')[1:]),
'PV_RESULTAAT_ID': f"{self.investigation_groups[0]}_{self.effective_stress}_{self.analysis_type}",
'PV_TYPEVERZAMELING': self.alpha,
'PV_A1_SNIJPUNT_YAS_GEM [-]': round(self.snijpunt_gem_handmatig, 3) if self.snijpunt_gem_handmatig is not None else None,
'PV_A1_SNIJPUNT_YAS_GEM [-]': round(self.snijpunt_gem_handmatig,
3) if self.snijpunt_gem_handmatig is not None else None,
'PV_A2_S_GEM [-]': round(self.s_gem_handmatig, 3) if self.s_gem_handmatig is not None else None,
'PV_m_GEM [-]': round(self.m_gem_handmatig, 3) if self.m_gem_handmatig is not None else None,
'PV_POP_GEM [kPa]': round(self.pop_gem_handmatig, 3) if self.pop_gem_handmatig is not None else None,
'PV_A1_SNIJPUNT_YAS_KAR [-]': round(self.snijpunt_kar_handmatig, 3) if self.snijpunt_kar_handmatig is not None else None,
'PV_A1_SNIJPUNT_YAS_KAR [-]': round(self.snijpunt_kar_handmatig,
3) if self.snijpunt_kar_handmatig is not None else None,
'PV_A2_S_KAR [-]': round(self.s_kar_handmatig, 3) if self.s_kar_handmatig is not None else None,
'PV_m_KAR [-]': round(self.m_kar_handmatig, 3) if self.m_kar_handmatig is not None else None,
'PV_POP_KAR [kPa]': round(self.pop_kar_handmatig, 3) if self.pop_kar_handmatig is not None else None,
Expand Down Expand Up @@ -119,6 +122,7 @@ def add_results_to_dbase(self: "SHANSEP", path: str, file_name: str = 'Template_

return df_updated


def add_results_to_template(self: "SHANSEP", path, export_name=None):
"""
Voegt de SHANSEP analyseresultaten toe aan de database Excel-bestand.
Expand Down Expand Up @@ -162,11 +166,13 @@ def add_results_to_template(self: "SHANSEP", path, export_name=None):
'PV_ANALYSE': '_'.join(self.analysis_type.split('_')[1:]),
'PV_RESULTAAT_ID': f"{self.investigation_groups[0]}_{self.effective_stress}_{self.analysis_type}",
'PV_TYPEVERZAMELING': self.alpha,
'PV_A1_SNIJPUNT_YAS_GEM [-]': round(self.snijpunt_gem_handmatig, 3) if self.snijpunt_gem_handmatig is not None else None,
'PV_A1_SNIJPUNT_YAS_GEM [-]': round(self.snijpunt_gem_handmatig,
3) if self.snijpunt_gem_handmatig is not None else None,
'PV_A2_S_GEM [-]': round(self.s_gem_handmatig, 3) if self.s_gem_handmatig is not None else None,
'PV_m_GEM [-]': round(self.m_gem_handmatig, 3) if self.m_gem_handmatig is not None else None,
'PV_POP_GEM [kPa]': round(self.pop_gem_handmatig, 3) if self.pop_gem_handmatig is not None else None,
'PV_A1_SNIJPUNT_YAS_KAR [-]': round(self.snijpunt_kar_handmatig, 3) if self.snijpunt_kar_handmatig is not None else None,
'PV_A1_SNIJPUNT_YAS_KAR [-]': round(self.snijpunt_kar_handmatig,
3) if self.snijpunt_kar_handmatig is not None else None,
'PV_A2_S_KAR [-]': round(self.s_kar_handmatig, 3) if self.s_kar_handmatig is not None else None,
'PV_m_KAR [-]': round(self.m_kar_handmatig, 3) if self.m_kar_handmatig is not None else None,
'PV_POP_KAR [kPa]': round(self.pop_kar_handmatig, 3) if self.pop_kar_handmatig is not None else None,
Expand Down Expand Up @@ -220,6 +226,7 @@ def add_results_to_template(self: "SHANSEP", path, export_name=None):
wb.save(file_path)
print(f"Resultaat toegevoegd aan template in tabblad '{sheet_name}'.")


def save_total_to_excel(self: "SHANSEP", path: str):
"""
Exporteert alle SHANSEP analysegegevens naar Excel.
Expand Down Expand Up @@ -393,8 +400,8 @@ def _create_input_table(self: "SHANSEP") -> Table:
# Add additional columns from shansep_data_df_nc_oc if available and data is properly sorted
additional_columns = ['S\'v', 'Su', 'consolidatietype', 'OCR']
if (hasattr(self, 'shansep_data_df_nc_oc_unsorted') and
self.shansep_data_df_nc_oc_unsorted is not None and
len(self.shansep_data_df_nc_oc_unsorted) == len(table_df)):
self.shansep_data_df_nc_oc_unsorted is not None and
len(self.shansep_data_df_nc_oc_unsorted) == len(table_df)):

# Check which additional columns are available
for col in additional_columns:
Expand All @@ -404,7 +411,8 @@ def _create_input_table(self: "SHANSEP") -> Table:
table_df[col] = self.shansep_data_df_nc_oc_unsorted[col]

else:
print(f"WAARSCHUWING: extra kolommen {additional_columns} in invoer tabel konden niet worden toegevoegd aan invoer tabel vanwege ontbrekende of niet-overeenkomende gegevens.")
print(
f"WAARSCHUWING: extra kolommen {additional_columns} in invoer tabel konden niet worden toegevoegd aan invoer tabel vanwege ontbrekende of niet-overeenkomende gegevens.")

# Hernoem kolommen voor leesbaarheid met kortere namen en line breaks
column_mapping = {
Expand All @@ -430,16 +438,17 @@ def _create_input_table(self: "SHANSEP") -> Table:

# replace column POP by new calculation to account for missing values: terreinspanning*ocr-terreinspanning
if 'Terreinspanning\n[kPa]' in table_df.columns and 'OCR\n[-]' in table_df.columns:
table_df['POP\n[-]'] = table_df['Terreinspanning\n[kPa]'] * table_df['OCR\n[-]'] - table_df['Terreinspanning\n[kPa]']
table_df['POP\n[-]'] = table_df['Terreinspanning\n[kPa]'] * table_df['OCR\n[-]'] - table_df[
'Terreinspanning\n[kPa]']

# Sort table_df in the same way as shansep_data_df_nc_oc
# Check if consolidatietype column exists in the data (use original column name before renaming)

if 'consolidatietype' in table_df.columns:
table_df = table_df.sort_values(
by=['consolidatietype', table_df.index.name or table_df.index],
ascending=[False, True]
).copy()
by=['consolidatietype', table_df.index.name or table_df.index],
ascending=[False, True]
).copy()
else:
table_df = table_df.sort_index()
print(f"WAARSCHUWING: invoer tabel kon niet worden gesorteerd op 'consolidatietype' omdat de kolom ontbreekt.")
Expand Down Expand Up @@ -508,7 +517,6 @@ def _create_input_table(self: "SHANSEP") -> Table:
return t1



def _create_parameters_table(self: "SHANSEP") -> Table:
"""
Maakt een tabel met de SHANSEP parameters.
Expand Down Expand Up @@ -604,6 +612,7 @@ def _create_gem_results_table(self: "SHANSEP") -> Table:
]))
return t


def _create_kar_results_table(self: "SHANSEP") -> Table:
"""
Maakt een tabel met de SHANSEP karakteristieke resultaten (alleen voorgestelde parameters).
Expand Down Expand Up @@ -650,6 +659,7 @@ def _create_kar_results_table(self: "SHANSEP") -> Table:
]))
return t


def _create_handmatig_results_table(self: "SHANSEP") -> Table:
"""
Maakt een tabel met de SHANSEP handmatige parameters in horizontale indeling.
Expand Down Expand Up @@ -701,6 +711,7 @@ def _create_handmatig_results_table(self: "SHANSEP") -> Table:
]))
return t


def save_to_pdf(self: "SHANSEP", path: str) -> str:
"""
Slaat de SHANSEP analyseresultaten op in een PDF-document.
Expand Down Expand Up @@ -760,13 +771,13 @@ def save_to_pdf(self: "SHANSEP", path: str) -> str:
self.show_title = False

# Genereer figuur
self.figure = go.Figure()
self.figure_sv_su = go.Figure()
self.set_figure_sv_su()

if hasattr(self, 'figure') and self.figure is not None:
if hasattr(self, 'figure_sv_su') and self.figure_sv_su is not None:
fig_width = 1280
fig_height = 720
self.figure.write_image(fig_path1, width=fig_width, height=fig_height, scale=4, format="png")
self.figure_sv_su.write_image(fig_path1, width=fig_width, height=fig_height, scale=4, format="png")

# Bereken figuurgrootte voor pagina 1 (met titel en heading)
# Ruimte voor titel (ongeveer 50 pt) + heading (ongeveer 25 pt) + spacers (ongeveer 25 pt)
Expand Down Expand Up @@ -798,9 +809,11 @@ def save_to_pdf(self: "SHANSEP", path: str) -> str:

# Voeg titel toe die aangeeft of handmatige parameters zijn gebruikt
if has_manual_params:
story.append(Paragraph("s<sub>u</sub> - σ'<sub>v</sub> Relatie (met handmatige parameters)", styles['Heading3']))
story.append(
Paragraph("s<sub>u</sub> - σ'<sub>v</sub> Relatie (met handmatige parameters)", styles['Heading3']))
else:
story.append(Paragraph("s<sub>u</sub> - σ'<sub>v</sub> Relatie (met voorgestelde parameters)", styles['Heading3']))
story.append(Paragraph("s<sub>u</sub> - σ'<sub>v</sub> Relatie (met voorgestelde parameters)",
styles['Heading3']))
story.append(Spacer(width=1, height=12))
story.append(img1)

Expand All @@ -819,13 +832,13 @@ def save_to_pdf(self: "SHANSEP", path: str) -> str:
self.show_title = False

# Genereer figuur
self.figure = go.Figure()
self.figure_ln_ocr_ln_s = go.Figure()
self.set_figure_ln_ocr_ln_s()

if hasattr(self, 'figure') and self.figure is not None:
if hasattr(self, 'figure_ln_ocr_ln_s') and self.figure_ln_ocr_ln_s is not None:
fig_width = 1280
fig_height = 720
self.figure.write_image(fig_path2, width=fig_width, height=fig_height, scale=4, format="png")
self.figure_ln_ocr_ln_s.write_image(fig_path2, width=fig_width, height=fig_height, scale=4, format="png")

# Bereken figuurgrootte voor pagina 2 (alleen met heading)
# Ruimte voor heading (ongeveer 25 pt) + spacer (ongeveer 12 pt)
Expand Down Expand Up @@ -859,7 +872,8 @@ def save_to_pdf(self: "SHANSEP", path: str) -> str:
if has_manual_params:
story.append(Paragraph("LN(OCR) - LN(su/σ'v) Relatie (met handmatige parameters)", styles['Heading3']))
else:
story.append(Paragraph("LN(OCR) - LN(su/σ'v) Relatie (met voorgestelde parameters)", styles['Heading3']))
story.append(
Paragraph("LN(OCR) - LN(su/σ'v) Relatie (met voorgestelde parameters)", styles['Heading3']))
story.append(Spacer(width=1, height=12))
story.append(img2)

Expand All @@ -877,13 +891,13 @@ def save_to_pdf(self: "SHANSEP", path: str) -> str:
fig_path3 = f"{path}/temp_plot3.png"
self.show_title = False

self.figure = go.Figure()
self.figure_sv_su_nc = go.Figure()
self.set_figure_sv_su_nc()

if hasattr(self, 'figure') and self.figure is not None:
if hasattr(self, 'figure_sv_su_nc') and self.figure_sv_su is not None:
fig_width = 1280
fig_height = 720
self.figure.write_image(fig_path3, width=fig_width, height=fig_height, scale=4, format="png")
self.figure_sv_su_nc.write_image(fig_path3, width=fig_width, height=fig_height, scale=4, format="png")

# Bereken figuurgrootte voor pagina 3 (alleen met heading)
# Ruimte voor heading (ongeveer 25 pt) + spacer (ongeveer 12 pt)
Expand Down Expand Up @@ -915,9 +929,13 @@ def save_to_pdf(self: "SHANSEP", path: str) -> str:

# Voeg titel toe die aangeeft of handmatige parameters zijn gebruikt
if has_manual_params:
story.append(Paragraph("s<sub>u</sub> - σ'<sub>v</sub> Relatie op alleen NC proeven (met handmatige parameters)", styles['Heading3']))
story.append(
Paragraph("s<sub>u</sub> - σ'<sub>v</sub> Relatie op alleen NC proeven (met handmatige parameters)",
styles['Heading3']))
else:
story.append(Paragraph("s<sub>u</sub> - σ'<sub>v</sub> Relatie op alleen NC proeven (met voorgestelde parameters)", styles['Heading3']))
story.append(Paragraph(
"s<sub>u</sub> - σ'<sub>v</sub> Relatie op alleen NC proeven (met voorgestelde parameters)",
styles['Heading3']))
story.append(Spacer(width=1, height=12))
story.append(img3)

Expand Down Expand Up @@ -965,7 +983,6 @@ def save_to_pdf(self: "SHANSEP", path: str) -> str:
story.append(_create_handmatig_results_table(self))
story.append(Spacer(1, 12))


# Voeg Su tabel toe indien beschikbaar
if hasattr(self, 'sutabel') and self.sutabel is not None:
story.append(Paragraph("Su Tabel", styles['Heading2']))
Expand Down
Loading