GauthierDemonchy commited on
Commit
96e4e46
·
1 Parent(s): abf1df5
Files changed (6) hide show
  1. .idea/misc.xml +1 -1
  2. .idea/pixi-tool.iml +1 -1
  3. .idea/workspace.xml +43 -23
  4. app.py +2 -2
  5. data.py +50 -10
  6. output2.txt +3 -2
.idea/misc.xml CHANGED
@@ -3,5 +3,5 @@
3
  <component name="Black">
4
  <option name="sdkName" value="Python 3.11" />
5
  </component>
6
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (Reuseud_frame_calc)" project-jdk-type="Python SDK" />
7
  </project>
 
3
  <component name="Black">
4
  <option name="sdkName" value="Python 3.11" />
5
  </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Sanitary_calculator" project-jdk-type="Python SDK" />
7
  </project>
.idea/pixi-tool.iml CHANGED
@@ -2,7 +2,7 @@
2
  <module type="PYTHON_MODULE" version="4">
3
  <component name="NewModuleRootManager">
4
  <content url="file://$MODULE_DIR$" />
5
- <orderEntry type="jdk" jdkName="Python 3.11 (Reuseud_frame_calc)" jdkType="Python SDK" />
6
  <orderEntry type="sourceFolder" forTests="false" />
7
  </component>
8
  </module>
 
2
  <module type="PYTHON_MODULE" version="4">
3
  <component name="NewModuleRootManager">
4
  <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="jdk" jdkName="Sanitary_calculator" jdkType="Python SDK" />
6
  <orderEntry type="sourceFolder" forTests="false" />
7
  </component>
8
  </module>
.idea/workspace.xml CHANGED
@@ -8,6 +8,9 @@
8
  <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
9
  <change beforePath="$PROJECT_DIR$/.idea/pixi-tool.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/pixi-tool.iml" afterDir="false" />
10
  <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
 
 
 
11
  </list>
12
  <option name="SHOW_DIALOG" value="false" />
13
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -59,25 +62,26 @@
59
  <option name="hideEmptyMiddlePackages" value="true" />
60
  <option name="showLibraryContents" value="true" />
61
  </component>
62
- <component name="PropertiesComponent"><![CDATA[{
63
- "keyToString": {
64
- "DefaultHtmlFileTemplate": "HTML File",
65
- "Python.app.executor": "Run",
66
- "Python.calculs.executor": "Run",
67
- "Python.data.executor": "Run",
68
- "RunOnceActivity.ShowReadmeOnStart": "true",
69
- "git-widget-placeholder": "main",
70
- "last_opened_file_path": "C:/Users/gauthier.demonchy/PycharmProjects/Reuseud_frame_calc",
71
- "list.type.of.created.stylesheet": "CSS",
72
- "node.js.detected.package.eslint": "true",
73
- "node.js.detected.package.tslint": "true",
74
- "node.js.selected.package.eslint": "(autodetect)",
75
- "node.js.selected.package.tslint": "(autodetect)",
76
- "nodejs_package_manager_path": "npm",
77
- "settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable",
78
- "vue.rearranger.settings.migration": "true"
 
79
  }
80
- }]]></component>
81
  <component name="RunAnythingCache">
82
  <option name="myCommands">
83
  <command value="pip install numpy matplotlib scikit-learn pillow" />
@@ -164,8 +168,8 @@
164
  <component name="SharedIndexes">
165
  <attachedChunks>
166
  <set>
167
- <option value="bundled-js-predefined-1d06a55b98c1-0b3e54e931b4-JavaScript-PY-241.18034.82" />
168
- <option value="bundled-python-sdk-975db3bf15a3-2767605e8bc2-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-241.18034.82" />
169
  </set>
170
  </attachedChunks>
171
  </component>
@@ -195,6 +199,13 @@
195
  <workItem from="1744716843008" duration="82000" />
196
  <workItem from="1745236741113" duration="499000" />
197
  <workItem from="1745431338562" duration="5000" />
 
 
 
 
 
 
 
198
  </task>
199
  <task id="LOCAL-00001" summary="v1">
200
  <option name="closed" value="true" />
@@ -276,7 +287,15 @@
276
  <option name="project" value="LOCAL" />
277
  <updated>1744633107181</updated>
278
  </task>
279
- <option name="localTasksCounter" value="11" />
 
 
 
 
 
 
 
 
280
  <servers />
281
  </component>
282
  <component name="TypeScriptGeneratedFilesManager">
@@ -302,10 +321,11 @@
302
  <option name="LAST_COMMIT_MESSAGE" value="v1" />
303
  </component>
304
  <component name="com.intellij.coverage.CoverageDataManagerImpl">
305
- <SUITE FILE_PATH="coverage/imc_gradio_ipynb$app.coverage" NAME="app Coverage Results" MODIFIED="1741708979306" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
306
  <SUITE FILE_PATH="coverage/data_py$app.coverage" NAME="app Coverage Results" MODIFIED="1742302713551" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
 
307
  <SUITE FILE_PATH="coverage/app_py$calculs.coverage" NAME="calculs Coverage Results" MODIFIED="1741872394315" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
308
  <SUITE FILE_PATH="coverage/data_py$data.coverage" NAME="data Coverage Results" MODIFIED="1741950630194" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
309
- <SUITE FILE_PATH="coverage/app_py$app.coverage" NAME="app Coverage Results" MODIFIED="1745236615335" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
 
310
  </component>
311
  </project>
 
8
  <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
9
  <change beforePath="$PROJECT_DIR$/.idea/pixi-tool.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/pixi-tool.iml" afterDir="false" />
10
  <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
11
+ <change beforePath="$PROJECT_DIR$/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/app.py" afterDir="false" />
12
+ <change beforePath="$PROJECT_DIR$/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/data.py" afterDir="false" />
13
+ <change beforePath="$PROJECT_DIR$/output2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/output2.txt" afterDir="false" />
14
  </list>
15
  <option name="SHOW_DIALOG" value="false" />
16
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
 
62
  <option name="hideEmptyMiddlePackages" value="true" />
63
  <option name="showLibraryContents" value="true" />
64
  </component>
65
+ <component name="PropertiesComponent">{
66
+ &quot;keyToString&quot;: {
67
+ &quot;DefaultHtmlFileTemplate&quot;: &quot;HTML File&quot;,
68
+ &quot;Python.app.executor&quot;: &quot;Run&quot;,
69
+ &quot;Python.calculs.executor&quot;: &quot;Run&quot;,
70
+ &quot;Python.data.executor&quot;: &quot;Run&quot;,
71
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
72
+ &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
73
+ &quot;git-widget-placeholder&quot;: &quot;main&quot;,
74
+ &quot;last_opened_file_path&quot;: &quot;C:/Users/gauthier.demonchy/PycharmProjects/Reuseud_frame_calc&quot;,
75
+ &quot;list.type.of.created.stylesheet&quot;: &quot;CSS&quot;,
76
+ &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
77
+ &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
78
+ &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
79
+ &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
80
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
81
+ &quot;settings.editor.selected.configurable&quot;: &quot;com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable&quot;,
82
+ &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
83
  }
84
+ }</component>
85
  <component name="RunAnythingCache">
86
  <option name="myCommands">
87
  <command value="pip install numpy matplotlib scikit-learn pillow" />
 
168
  <component name="SharedIndexes">
169
  <attachedChunks>
170
  <set>
171
+ <option value="bundled-js-predefined-d6986cc7102b-09060db00ec0-JavaScript-PY-251.26927.90" />
172
+ <option value="bundled-python-sdk-41e8cd69c857-64d779b69b7a-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-251.26927.90" />
173
  </set>
174
  </attachedChunks>
175
  </component>
 
199
  <workItem from="1744716843008" duration="82000" />
200
  <workItem from="1745236741113" duration="499000" />
201
  <workItem from="1745431338562" duration="5000" />
202
+ <workItem from="1745431394726" duration="255000" />
203
+ <workItem from="1749466781819" duration="2343000" />
204
+ <workItem from="1750170429122" duration="214000" />
205
+ <workItem from="1754565769546" duration="45000" />
206
+ <workItem from="1756202953216" duration="449000" />
207
+ <workItem from="1765528841689" duration="7173000" />
208
+ <workItem from="1765812400722" duration="590000" />
209
  </task>
210
  <task id="LOCAL-00001" summary="v1">
211
  <option name="closed" value="true" />
 
287
  <option name="project" value="LOCAL" />
288
  <updated>1744633107181</updated>
289
  </task>
290
+ <task id="LOCAL-00011" summary="v1">
291
+ <option name="closed" value="true" />
292
+ <created>1745431463926</created>
293
+ <option name="number" value="00011" />
294
+ <option name="presentableId" value="LOCAL-00011" />
295
+ <option name="project" value="LOCAL" />
296
+ <updated>1745431463926</updated>
297
+ </task>
298
+ <option name="localTasksCounter" value="12" />
299
  <servers />
300
  </component>
301
  <component name="TypeScriptGeneratedFilesManager">
 
321
  <option name="LAST_COMMIT_MESSAGE" value="v1" />
322
  </component>
323
  <component name="com.intellij.coverage.CoverageDataManagerImpl">
 
324
  <SUITE FILE_PATH="coverage/data_py$app.coverage" NAME="app Coverage Results" MODIFIED="1742302713551" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
325
+ <SUITE FILE_PATH="coverage/app_py$data.coverage" NAME="data Coverage Results" MODIFIED="1765530440933" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
326
  <SUITE FILE_PATH="coverage/app_py$calculs.coverage" NAME="calculs Coverage Results" MODIFIED="1741872394315" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
327
  <SUITE FILE_PATH="coverage/data_py$data.coverage" NAME="data Coverage Results" MODIFIED="1741950630194" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
328
+ <SUITE FILE_PATH="coverage/imc_gradio_ipynb$app.coverage" NAME="app Coverage Results" MODIFIED="1741708979306" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
329
+ <SUITE FILE_PATH="coverage/app_py$app.coverage" NAME="app Coverage Results" MODIFIED="1765812413365" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
330
  </component>
331
  </project>
app.py CHANGED
@@ -18,7 +18,7 @@ Si le point de croisement est atteint, le remplacement des cadres est intéressa
18
  # Définition des choix possibles
19
  options_chauffage = {
20
  "Pompe à chaleur": ["Pac COPA 2,7", "Pac COPA 3,2", "Pac COPA 4,4", "Pac COPA 5,3"],
21
- "Chaudiere": ["Chaudiere gaz naturel", "Chaudiere pellet", "Chaudiere buche", "Chaudiere biogaz"]
22
  }
23
 
24
  # Mise à jour des options de chauffage dynamiquement
@@ -102,4 +102,4 @@ with gr.Blocks(css="""
102
  outputs=[result, image_output])
103
 
104
  # Lancer l'interface
105
- demo.launch()
 
18
  # Définition des choix possibles
19
  options_chauffage = {
20
  "Pompe à chaleur": ["Pac COPA 2,7", "Pac COPA 3,2", "Pac COPA 4,4", "Pac COPA 5,3"],
21
+ "Chaudiere": ["Chaudiere gaz naturel", "Chaudiere pellet", "Chaudiere buche", "Chaudiere biogaz","Chauffage à distance"]
22
  }
23
 
24
  # Mise à jour des options de chauffage dynamiquement
 
102
  outputs=[result, image_output])
103
 
104
  # Lancer l'interface
105
+ demo.launch()
data.py CHANGED
@@ -1,16 +1,16 @@
1
  import numpy as np
2
  import pandas as pd
3
 
4
- # Chargement des facteurs d'émission depuis output1.csv
5
  file_path = "output2.txt"
6
  factors_df = pd.read_csv(file_path, delimiter=";", names=["Producer", "Emission Factor"], dtype=str, encoding="latin1")
7
 
8
-
9
- # Nettoyage des données
10
- factors_df["Emission Factor"] = factors_df["Emission Factor"].str.replace(",", ".").astype(float) # Conversion des nombres
11
 
12
  # Définition des valeurs de Qh en fonction de Delta Uf établi à partir de lesosai
13
- q_h_values = np.array([0.000,0.250,0.500,0.750,1.000,1.250,1.472,1.722,1.972,2.222,2.472,2.722,2.944])
14
  delta_uf_values = np.array([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2])
15
 
16
 
@@ -19,9 +19,48 @@ def calculate_ges_coefficients(producer_name):
19
  """
20
  Calcule le coefficient GES (a) en imposant b = 0.
21
  """
22
- factor = factors_df.loc[factors_df["Producer"] == producer_name, "Emission Factor"].values
 
 
 
 
 
 
 
 
 
 
 
 
23
  if len(factor) == 0:
24
- raise ValueError(f"Facteur d'émission introuvable pour {producer_name}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  factor = factor[0]
27
  ges_values = q_h_values * factor
@@ -42,6 +81,7 @@ coefficients = {
42
  "Pac COPA 3,2": calculate_ges_coefficients("Pac COPA 3,2"),
43
  "Chaudiere pellet": calculate_ges_coefficients("Chaudiere pellet"),
44
  "Chaudiere buche": calculate_ges_coefficients("Chaudiere buche"),
 
45
  "Cadre bois": (0.000, 0.041),
46
  "Cadre bois métal": (0.000, 0.074),
47
  "Cadre PVC": (0.000, 0.072),
@@ -51,7 +91,7 @@ coefficients = {
51
  # Données pour la régression Uf selon le type de cadre
52
  data = {
53
  "Bois": [1.8, 0.9],
54
- "Bois-métal": [1.8, 1],
55
  "PVC": [1.8, 1.3],
56
- "Alu": [3.6, 1.35]
57
- }
 
1
  import numpy as np
2
  import pandas as pd
3
 
4
+ # Chargement des facteurs d'émission depuis output2.txt
5
  file_path = "output2.txt"
6
  factors_df = pd.read_csv(file_path, delimiter=";", names=["Producer", "Emission Factor"], dtype=str, encoding="latin1")
7
 
8
+ # Nettoyage des données - suppression des espaces et normalisation
9
+ factors_df["Producer"] = factors_df["Producer"].str.strip()
10
+ factors_df["Emission Factor"] = factors_df["Emission Factor"].str.replace(",", ".").str.strip().astype(float)
11
 
12
  # Définition des valeurs de Qh en fonction de Delta Uf établi à partir de lesosai
13
+ q_h_values = np.array([0.000, 0.250, 0.500, 0.750, 1.000, 1.250, 1.472, 1.722, 1.972, 2.222, 2.472, 2.722, 2.944])
14
  delta_uf_values = np.array([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2])
15
 
16
 
 
19
  """
20
  Calcule le coefficient GES (a) en imposant b = 0.
21
  """
22
+ # Nettoyage du nom recherché
23
+ producer_name_clean = producer_name.strip()
24
+
25
+ # Recherche avec correspondance exacte
26
+ factor = factors_df.loc[factors_df["Producer"] == producer_name_clean, "Emission Factor"].values
27
+
28
+ # Si pas de correspondance exacte, essayer une recherche plus flexible
29
+ if len(factor) == 0:
30
+ # Recherche insensible à la casse
31
+ factor = factors_df.loc[
32
+ factors_df["Producer"].str.lower() == producer_name_clean.lower(), "Emission Factor"].values
33
+
34
+ # Si toujours pas trouvé, utiliser une valeur par défaut basée sur le type
35
  if len(factor) == 0:
36
+ # Dictionnaire de valeurs par défaut
37
+ default_factors = {
38
+ "Chauffage à distance": 0.066,
39
+ "Pac COPA 2,7": 0.058,
40
+ "Pac COPA 5,3": 0.035,
41
+ "Pac COPA 4,4": 0.040,
42
+ "Pac COPA 3,2": 0.048,
43
+ "Chaudiere gaz naturel": 0.230,
44
+ "Chaudiere biogaz": 0.127,
45
+ "Chaudiere mazout": 0.324,
46
+ "Chaudiere buche": 0.033,
47
+ "Chaudiere pellet": 0.038
48
+ }
49
+
50
+ if producer_name_clean in default_factors:
51
+ factor = [default_factors[producer_name_clean]]
52
+ else:
53
+ # Dernière tentative avec une recherche partielle
54
+ for key, value in default_factors.items():
55
+ if key.lower() in producer_name_clean.lower() or producer_name_clean.lower() in key.lower():
56
+ factor = [value]
57
+ break
58
+
59
+ # Si toujours rien trouvé, lever une erreur avec plus d'informations
60
+ if len(factor) == 0:
61
+ available_producers = factors_df["Producer"].tolist()
62
+ raise ValueError(
63
+ f"Facteur d'émission introuvable pour '{producer_name_clean}'. Producteurs disponibles : {available_producers}")
64
 
65
  factor = factor[0]
66
  ges_values = q_h_values * factor
 
81
  "Pac COPA 3,2": calculate_ges_coefficients("Pac COPA 3,2"),
82
  "Chaudiere pellet": calculate_ges_coefficients("Chaudiere pellet"),
83
  "Chaudiere buche": calculate_ges_coefficients("Chaudiere buche"),
84
+ "Chauffage à distance": calculate_ges_coefficients("Chauffage à distance"),
85
  "Cadre bois": (0.000, 0.041),
86
  "Cadre bois métal": (0.000, 0.074),
87
  "Cadre PVC": (0.000, 0.072),
 
91
  # Données pour la régression Uf selon le type de cadre
92
  data = {
93
  "Bois": [1.8, 0.9],
94
+ "Bois-métal": [2, 1],
95
  "PVC": [1.8, 1.3],
96
+ "Alu": [3.6, 0.8]
97
+ }
output2.txt CHANGED
@@ -2,8 +2,9 @@ Pac COPA 2,7;0,058
2
  Pac COPA 5,3;0,035
3
  Pac COPA 4,4;0,040
4
  Pac COPA 3,2;0,048
5
- Chaudiere gaz naturel;0,234
6
  Chaudiere biogaz;0,127
7
- Chaudiere mazout;0,0343
8
  Chaudiere buche;0,033
9
  Chaudiere pellet;0,038
 
 
2
  Pac COPA 5,3;0,035
3
  Pac COPA 4,4;0,040
4
  Pac COPA 3,2;0,048
5
+ Chaudiere gaz naturel;0,230
6
  Chaudiere biogaz;0,127
7
+ Chaudiere mazout;0,324
8
  Chaudiere buche;0,033
9
  Chaudiere pellet;0,038
10
+ Chauffage à distance;0,066