Spaces:
Sleeping
Sleeping
Sergio Salas commited on
Commit 路
d373fd9
1
Parent(s): 0582027
realizados test unitarios con archivos proporcionados. Falla el 3
Browse files- mieWeb/scripts/pruebas/__pycache__/calculo_prueba.cpython-312.pyc +0 -0
- mieWeb/scripts/pruebas/calculo_prueba.py +4 -2
- mieWeb/src/datos/Q_Ag_Johnson_R_25_nmed_1.txt +49 -0
- mieWeb/src/datos/Q_Ag_Johnson_R_50_nmed_1.txt +49 -0
- mieWeb/src/datos/Q_Au_Johnson_R_100_nmed_1.txt +49 -0
- mieWeb/src/datos/Q_Au_Johnson_R_50_nmed_1.5.txt +49 -0
- mieWeb/src/datos/Q_Au_Johnson_R_50_nmed_1.txt +49 -0
- mieWeb/src/negocio/__pycache__/descarga.cpython-312.pyc +0 -0
- mieWeb/src/negocio/descarga.py +2 -24
- mieWeb/src/presentacion/__pycache__/view.cpython-312.pyc +0 -0
- mieWeb/src/presentacion/view.py +2 -1
- mieWeb/src/test/__pycache__/pruebas.cpython-312.pyc +0 -0
- mieWeb/src/test/pruebas.py +131 -16
mieWeb/scripts/pruebas/__pycache__/calculo_prueba.cpython-312.pyc
ADDED
|
Binary file (242 Bytes). View file
|
|
|
mieWeb/scripts/pruebas/calculo_prueba.py
CHANGED
|
@@ -2,6 +2,7 @@ import numpy as np
|
|
| 2 |
import miepython
|
| 3 |
import sqlite3
|
| 4 |
|
|
|
|
| 5 |
def calculate_mie_arrays(material_data, radius):
|
| 6 |
results = {}
|
| 7 |
for material_id, (valor_lambda_array, n_array, k_array) in material_data.items():
|
|
@@ -21,8 +22,8 @@ def calculate_mie_arrays(material_data, radius):
|
|
| 21 |
return results
|
| 22 |
|
| 23 |
# Conectar a la base de datos SQLite
|
| 24 |
-
|
| 25 |
-
conn = sqlite3.connect(db_path)
|
| 26 |
cursor = conn.cursor()
|
| 27 |
|
| 28 |
# IDs de los materiales que queremos filtrar
|
|
@@ -60,3 +61,4 @@ for material_id, (qext_array, qsca_array, qabs_array) in results.items():
|
|
| 60 |
print(f" Coeficiente de absorci贸n (qabs): {qabs_array[i]:.4f}")
|
| 61 |
|
| 62 |
# Ejemplo: ahora puedes usar los resultados para gr谩ficas en matplotlib
|
|
|
|
|
|
| 2 |
import miepython
|
| 3 |
import sqlite3
|
| 4 |
|
| 5 |
+
""""
|
| 6 |
def calculate_mie_arrays(material_data, radius):
|
| 7 |
results = {}
|
| 8 |
for material_id, (valor_lambda_array, n_array, k_array) in material_data.items():
|
|
|
|
| 22 |
return results
|
| 23 |
|
| 24 |
# Conectar a la base de datos SQLite
|
| 25 |
+
#b_path = pruebas\prueba.db"
|
| 26 |
+
#conn = sqlite3.connect(db_path)
|
| 27 |
cursor = conn.cursor()
|
| 28 |
|
| 29 |
# IDs de los materiales que queremos filtrar
|
|
|
|
| 61 |
print(f" Coeficiente de absorci贸n (qabs): {qabs_array[i]:.4f}")
|
| 62 |
|
| 63 |
# Ejemplo: ahora puedes usar los resultados para gr谩ficas en matplotlib
|
| 64 |
+
"""
|
mieWeb/src/datos/Q_Ag_Johnson_R_25_nmed_1.txt
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
187.9 2.5871 0.61344 1.9737
|
| 2 |
+
191.6 2.5879 0.60295 1.9849
|
| 3 |
+
195.3 2.597 0.59685 2.0001
|
| 4 |
+
199.3 2.5977 0.58675 2.0109
|
| 5 |
+
203.3 2.597 0.57523 2.0217
|
| 6 |
+
207.3 2.5684 0.55589 2.0125
|
| 7 |
+
211.9 2.5345 0.53202 2.0024
|
| 8 |
+
216.4 2.4941 0.50744 1.9866
|
| 9 |
+
221.4 2.4271 0.47466 1.9524
|
| 10 |
+
226.2 2.3748 0.44557 1.9292
|
| 11 |
+
231.3 2.3237 0.4215 1.9022
|
| 12 |
+
237.1 2.2824 0.39633 1.8861
|
| 13 |
+
242.6 2.2207 0.37107 1.8497
|
| 14 |
+
249 2.1612 0.34464 1.8166
|
| 15 |
+
255.1 2.0839 0.31652 1.7674
|
| 16 |
+
261.6 1.9932 0.28513 1.7081
|
| 17 |
+
268.9 1.8779 0.25001 1.6279
|
| 18 |
+
276.1 1.7442 0.21201 1.5322
|
| 19 |
+
284.4 1.6151 0.17258 1.4425
|
| 20 |
+
292.4 1.4738 0.13319 1.3406
|
| 21 |
+
300.9 1.2392 0.083995 1.1552
|
| 22 |
+
310.7 0.83631 0.029223 0.80708
|
| 23 |
+
320.4 0.52567 0.012543 0.51313
|
| 24 |
+
331.5 0.70769 0.12513 0.58256
|
| 25 |
+
342.5 1.8256 0.4289 1.3967
|
| 26 |
+
354.2 6.4125 2.3663 4.0462
|
| 27 |
+
367.9 11.397 5.7165 5.6809
|
| 28 |
+
381.5 2.457 1.5125 0.94451
|
| 29 |
+
397.4 0.91644 0.58641 0.33003
|
| 30 |
+
413.3 0.47117 0.31181 0.15936
|
| 31 |
+
430.5 0.27192 0.19649 0.075428
|
| 32 |
+
450.9 0.17682 0.12934 0.047484
|
| 33 |
+
471.4 0.12864 0.089664 0.038975
|
| 34 |
+
495.9 0.089228 0.062833 0.026394
|
| 35 |
+
520.9 0.064283 0.045691 0.018592
|
| 36 |
+
548.6 0.049095 0.033351 0.015744
|
| 37 |
+
582.1 0.033498 0.024074 0.0094234
|
| 38 |
+
616.8 0.025958 0.017711 0.0082466
|
| 39 |
+
659.5 0.017637 0.012667 0.0049699
|
| 40 |
+
704.5 0.012114 0.0091938 0.0029206
|
| 41 |
+
756 0.008194 0.0065931 0.0016009
|
| 42 |
+
821.1 0.0060421 0.0045211 0.001521
|
| 43 |
+
892 0.0041914 0.003114 0.0010774
|
| 44 |
+
984 0.0027777 0.0020278 0.00074991
|
| 45 |
+
1088 0.0018382 0.0013156 0.00052262
|
| 46 |
+
1216 0.0016205 0.00082025 0.00080026
|
| 47 |
+
1393 0.0012256 0.00046524 0.00076039
|
| 48 |
+
1610 0.00082282 0.00025552 0.00056731
|
| 49 |
+
1937 0.00067332 0.00011999 0.00055332
|
mieWeb/src/datos/Q_Ag_Johnson_R_50_nmed_1.txt
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
187.9 2.8916 1.224 1.6676
|
| 2 |
+
191.6 2.9091 1.2276 1.6815
|
| 3 |
+
195.3 2.9303 1.2369 1.6934
|
| 4 |
+
199.3 2.9479 1.2443 1.7036
|
| 5 |
+
203.3 2.9625 1.2505 1.7119
|
| 6 |
+
207.3 2.9671 1.2506 1.7164
|
| 7 |
+
211.9 2.9687 1.2483 1.7204
|
| 8 |
+
216.4 2.9678 1.2452 1.7226
|
| 9 |
+
221.4 2.9586 1.236 1.7227
|
| 10 |
+
226.2 2.9511 1.2259 1.7252
|
| 11 |
+
231.3 2.9536 1.2264 1.7272
|
| 12 |
+
237.1 2.9575 1.2237 1.7338
|
| 13 |
+
242.6 2.9603 1.2224 1.7379
|
| 14 |
+
249 2.966 1.2195 1.7465
|
| 15 |
+
255.1 2.9647 1.21 1.7547
|
| 16 |
+
261.6 2.9541 1.1888 1.7652
|
| 17 |
+
268.9 2.933 1.1562 1.7769
|
| 18 |
+
276.1 2.8819 1.0964 1.7855
|
| 19 |
+
284.4 2.7911 1.0006 1.7905
|
| 20 |
+
292.4 2.6335 0.86263 1.7709
|
| 21 |
+
300.9 2.2856 0.62534 1.6603
|
| 22 |
+
310.7 1.5058 0.25355 1.2523
|
| 23 |
+
320.4 0.90045 0.11306 0.78739
|
| 24 |
+
331.5 1.3408 0.7255 0.61528
|
| 25 |
+
342.5 2.6374 1.5152 1.1222
|
| 26 |
+
354.2 5.4365 3.1968 2.2398
|
| 27 |
+
367.9 5.974 5.0916 0.88244
|
| 28 |
+
381.5 7.9927 7.3088 0.68385
|
| 29 |
+
397.4 8.5406 7.8991 0.64155
|
| 30 |
+
413.3 7.0899 6.609 0.48091
|
| 31 |
+
430.5 5.2207 4.9522 0.26856
|
| 32 |
+
450.9 3.5609 3.3862 0.17471
|
| 33 |
+
471.4 2.4313 2.2915 0.13982
|
| 34 |
+
495.9 1.6363 1.5452 0.091111
|
| 35 |
+
520.9 1.1379 1.0762 0.061647
|
| 36 |
+
548.6 0.80128 0.75105 0.050226
|
| 37 |
+
582.1 0.54904 0.51997 0.029069
|
| 38 |
+
616.8 0.39324 0.36844 0.024801
|
| 39 |
+
659.5 0.26891 0.25426 0.014656
|
| 40 |
+
704.5 0.18754 0.17902 0.0085241
|
| 41 |
+
756 0.12957 0.12491 0.0046608
|
| 42 |
+
821.1 0.087862 0.08341 0.0044522
|
| 43 |
+
892 0.059406 0.056202 0.0032047
|
| 44 |
+
984 0.03813 0.035845 0.0022845
|
| 45 |
+
1088 0.024509 0.022866 0.0016434
|
| 46 |
+
1216 0.016667 0.014048 0.0026183
|
| 47 |
+
1393 0.010467 0.0078588 0.0026082
|
| 48 |
+
1610 0.0063149 0.0042709 0.002044
|
| 49 |
+
1937 0.0040974 0.0019854 0.002112
|
mieWeb/src/datos/Q_Au_Johnson_R_100_nmed_1.txt
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
187.9 2.7751 1.4089 1.3662
|
| 2 |
+
191.6 2.7881 1.4129 1.3752
|
| 3 |
+
195.3 2.8045 1.4238 1.3807
|
| 4 |
+
199.3 2.8226 1.4383 1.3843
|
| 5 |
+
203.3 2.8414 1.4531 1.3883
|
| 6 |
+
207.3 2.8631 1.4725 1.3907
|
| 7 |
+
211.9 2.8946 1.5015 1.3931
|
| 8 |
+
216.4 2.9215 1.5248 1.3967
|
| 9 |
+
221.4 2.9513 1.5502 1.4011
|
| 10 |
+
226.2 2.9756 1.5687 1.4069
|
| 11 |
+
231.3 3.006 1.594 1.4119
|
| 12 |
+
237.1 3.0314 1.6129 1.4186
|
| 13 |
+
242.6 3.06 1.6376 1.4224
|
| 14 |
+
249 3.0907 1.6674 1.4233
|
| 15 |
+
255.1 3.1216 1.7019 1.4197
|
| 16 |
+
261.6 3.1436 1.7318 1.4118
|
| 17 |
+
268.9 3.1561 1.7535 1.4026
|
| 18 |
+
276.1 3.1572 1.7637 1.3935
|
| 19 |
+
284.4 3.1597 1.7665 1.3932
|
| 20 |
+
292.4 3.1692 1.7693 1.3999
|
| 21 |
+
300.9 3.1783 1.7689 1.4094
|
| 22 |
+
310.7 3.2029 1.7746 1.4283
|
| 23 |
+
320.4 3.225 1.7759 1.4491
|
| 24 |
+
331.5 3.2626 1.7797 1.483
|
| 25 |
+
342.5 3.2774 1.7639 1.5135
|
| 26 |
+
354.2 3.2811 1.7421 1.5391
|
| 27 |
+
367.9 3.3033 1.7489 1.5544
|
| 28 |
+
381.5 3.3198 1.7605 1.5593
|
| 29 |
+
397.4 3.3067 1.7461 1.5606
|
| 30 |
+
413.3 3.295 1.7338 1.5613
|
| 31 |
+
430.5 3.2803 1.7155 1.5648
|
| 32 |
+
450.9 3.2917 1.7045 1.5872
|
| 33 |
+
471.4 3.3004 1.672 1.6284
|
| 34 |
+
495.9 3.477 1.7907 1.6863
|
| 35 |
+
520.9 4.0143 2.5817 1.4326
|
| 36 |
+
548.6 4.2609 3.3656 0.8953
|
| 37 |
+
582.1 4.5107 3.9905 0.52018
|
| 38 |
+
616.8 4.4699 4.1548 0.31513
|
| 39 |
+
659.5 4.0759 3.906 0.16991
|
| 40 |
+
704.5 3.4307 3.309 0.12174
|
| 41 |
+
756 2.6709 2.5751 0.095812
|
| 42 |
+
821.1 1.8803 1.8065 0.073783
|
| 43 |
+
892 1.2779 1.2253 0.052652
|
| 44 |
+
984 0.80904 0.76478 0.044264
|
| 45 |
+
1088 0.50735 0.47161 0.035733
|
| 46 |
+
1216 0.30932 0.27901 0.030309
|
| 47 |
+
1393 0.1732 0.14973 0.023474
|
| 48 |
+
1610 0.098429 0.078714 0.019715
|
| 49 |
+
1937 0.054998 0.035449 0.019549
|
mieWeb/src/datos/Q_Au_Johnson_R_50_nmed_1.5.txt
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
187.9 2.3436 1.0272 1.3163
|
| 2 |
+
191.6 2.3573 1.0176 1.3398
|
| 3 |
+
195.3 2.3778 1.0203 1.3575
|
| 4 |
+
199.3 2.397 1.031 1.366
|
| 5 |
+
203.3 2.4186 1.0405 1.3781
|
| 6 |
+
207.3 2.4396 1.0586 1.3811
|
| 7 |
+
211.9 2.4825 1.0829 1.3996
|
| 8 |
+
216.4 2.5165 1.1007 1.4158
|
| 9 |
+
221.4 2.5537 1.12 1.4337
|
| 10 |
+
226.2 2.5842 1.1318 1.4524
|
| 11 |
+
231.3 2.6195 1.1521 1.4674
|
| 12 |
+
237.1 2.6559 1.1641 1.4919
|
| 13 |
+
242.6 2.696 1.1846 1.5115
|
| 14 |
+
249 2.7492 1.2112 1.5381
|
| 15 |
+
255.1 2.8072 1.2446 1.5626
|
| 16 |
+
261.6 2.8665 1.2745 1.592
|
| 17 |
+
268.9 2.9159 1.2937 1.6222
|
| 18 |
+
276.1 2.9492 1.2988 1.6504
|
| 19 |
+
284.4 2.9604 1.2867 1.6737
|
| 20 |
+
292.4 2.9612 1.2707 1.6905
|
| 21 |
+
300.9 2.9568 1.251 1.7058
|
| 22 |
+
310.7 2.9518 1.2331 1.7187
|
| 23 |
+
320.4 2.944 1.2148 1.7292
|
| 24 |
+
331.5 2.933 1.194 1.739
|
| 25 |
+
342.5 2.9082 1.1623 1.7459
|
| 26 |
+
354.2 2.8846 1.1313 1.7533
|
| 27 |
+
367.9 2.9073 1.1345 1.7729
|
| 28 |
+
381.5 2.9431 1.1469 1.7962
|
| 29 |
+
397.4 2.9501 1.1315 1.8186
|
| 30 |
+
413.3 2.9526 1.1085 1.8441
|
| 31 |
+
430.5 2.9379 1.0664 1.8715
|
| 32 |
+
450.9 2.9134 1.0088 1.9045
|
| 33 |
+
471.4 2.8406 0.92039 1.9203
|
| 34 |
+
495.9 2.9213 0.95865 1.9627
|
| 35 |
+
520.9 3.8225 1.6546 2.1679
|
| 36 |
+
548.6 5.1211 3.0006 2.1206
|
| 37 |
+
582.1 6.9909 5.1436 1.8473
|
| 38 |
+
616.8 7.2462 5.9339 1.3123
|
| 39 |
+
659.5 4.9157 4.3369 0.57882
|
| 40 |
+
704.5 2.8708 2.5708 0.30002
|
| 41 |
+
756 1.6575 1.479 0.17848
|
| 42 |
+
821.1 0.92935 0.81951 0.10983
|
| 43 |
+
892 0.54845 0.48073 0.067716
|
| 44 |
+
984 0.32317 0.27218 0.050987
|
| 45 |
+
1088 0.19607 0.15826 0.037807
|
| 46 |
+
1216 0.11984 0.09013 0.029706
|
| 47 |
+
1393 0.068404 0.047129 0.021275
|
| 48 |
+
1610 0.041061 0.024398 0.016663
|
| 49 |
+
1937 0.026279 0.010867 0.015411
|
mieWeb/src/datos/Q_Au_Johnson_R_50_nmed_1.txt
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
187.9 2.8504 1.1824 1.668
|
| 2 |
+
191.6 2.8621 1.1874 1.6747
|
| 3 |
+
195.3 2.8793 1.1984 1.6809
|
| 4 |
+
199.3 2.8963 1.2081 1.6882
|
| 5 |
+
203.3 2.9143 1.2202 1.6941
|
| 6 |
+
207.3 2.9361 1.2335 1.7026
|
| 7 |
+
211.9 2.9733 1.2646 1.7087
|
| 8 |
+
216.4 3.001 1.2884 1.7125
|
| 9 |
+
221.4 3.0302 1.3148 1.7153
|
| 10 |
+
226.2 3.0504 1.3351 1.7153
|
| 11 |
+
231.3 3.08 1.3617 1.7183
|
| 12 |
+
237.1 3.1021 1.3864 1.7157
|
| 13 |
+
242.6 3.1336 1.4171 1.7164
|
| 14 |
+
249 3.1732 1.4587 1.7145
|
| 15 |
+
255.1 3.2199 1.5066 1.7133
|
| 16 |
+
261.6 3.2642 1.5544 1.7098
|
| 17 |
+
268.9 3.3037 1.5917 1.712
|
| 18 |
+
276.1 3.3315 1.6132 1.7182
|
| 19 |
+
284.4 3.3522 1.612 1.7402
|
| 20 |
+
292.4 3.368 1.5992 1.7688
|
| 21 |
+
300.9 3.3739 1.5777 1.7962
|
| 22 |
+
310.7 3.3827 1.5476 1.8351
|
| 23 |
+
320.4 3.3785 1.5097 1.8688
|
| 24 |
+
331.5 3.3825 1.4578 1.9247
|
| 25 |
+
342.5 3.3465 1.3868 1.9597
|
| 26 |
+
354.2 3.2872 1.3073 1.9799
|
| 27 |
+
367.9 3.2634 1.2574 2.006
|
| 28 |
+
381.5 3.2349 1.2125 2.0224
|
| 29 |
+
397.4 3.1323 1.1184 2.0138
|
| 30 |
+
413.3 3.0281 1.0229 2.0053
|
| 31 |
+
430.5 2.8984 0.91226 1.9862
|
| 32 |
+
450.9 2.8102 0.80482 2.0054
|
| 33 |
+
471.4 2.7255 0.69443 2.0311
|
| 34 |
+
495.9 3.0495 0.73973 2.3097
|
| 35 |
+
520.9 3.9063 1.3393 2.567
|
| 36 |
+
548.6 2.6381 1.2523 1.3858
|
| 37 |
+
582.1 1.2806 0.78572 0.49492
|
| 38 |
+
616.8 0.67873 0.48587 0.19285
|
| 39 |
+
659.5 0.37885 0.30479 0.074064
|
| 40 |
+
704.5 0.24658 0.20272 0.04386
|
| 41 |
+
756 0.16742 0.13617 0.031252
|
| 42 |
+
821.1 0.11155 0.088223 0.023328
|
| 43 |
+
892 0.07544 0.058488 0.016951
|
| 44 |
+
984 0.051724 0.036825 0.014899
|
| 45 |
+
1088 0.035952 0.023284 0.012667
|
| 46 |
+
1216 0.025533 0.01422 0.011313
|
| 47 |
+
1393 0.017103 0.0079055 0.009198
|
| 48 |
+
1610 0.012301 0.0042851 0.0080158
|
| 49 |
+
1937 0.010201 0.0019862 0.0082148
|
mieWeb/src/negocio/__pycache__/descarga.cpython-312.pyc
CHANGED
|
Binary files a/mieWeb/src/negocio/__pycache__/descarga.cpython-312.pyc and b/mieWeb/src/negocio/__pycache__/descarga.cpython-312.pyc differ
|
|
|
mieWeb/src/negocio/descarga.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
import tempfile
|
| 2 |
import zipfile
|
| 3 |
from bokeh.io import export_svg
|
| 4 |
-
|
| 5 |
-
from svglib.svglib import svg2rlg
|
| 6 |
|
| 7 |
from src.negocio.calculo import calculate_mie_arrays
|
| 8 |
|
|
@@ -47,28 +46,7 @@ def descargar_txt(presenter_instance):
|
|
| 47 |
|
| 48 |
|
| 49 |
def descargar_pdf(plot):
|
| 50 |
-
""
|
| 51 |
-
Exporta la gr谩fica Bokeh a un archivo PDF manteniendo la calidad.
|
| 52 |
-
"""
|
| 53 |
-
try:
|
| 54 |
-
# Exportar la gr谩fica a formato SVG
|
| 55 |
-
svg_path = "/tmp/graph.svg" # Ruta temporal para el archivo SVG
|
| 56 |
-
export_svg(plot, filename=svg_path)
|
| 57 |
-
|
| 58 |
-
# Convertir el SVG a un objeto de gr谩ficos
|
| 59 |
-
drawing = svg2rlg(svg_path)
|
| 60 |
-
|
| 61 |
-
# Ruta donde se guardar谩 el archivo PDF
|
| 62 |
-
pdf_path = "grafica.pdf"
|
| 63 |
|
| 64 |
-
# Guardar el gr谩fico como PDF usando renderPDF
|
| 65 |
-
renderPDF.drawToFile(drawing, pdf_path)
|
| 66 |
-
|
| 67 |
-
# Mensaje de 茅xito
|
| 68 |
-
print(f"PDF guardado correctamente en {pdf_path}")
|
| 69 |
-
|
| 70 |
-
except Exception as e:
|
| 71 |
-
# Manejo de errores
|
| 72 |
-
print(f"Error al exportar la gr谩fica como PDF: {e}")
|
| 73 |
|
| 74 |
|
|
|
|
| 1 |
import tempfile
|
| 2 |
import zipfile
|
| 3 |
from bokeh.io import export_svg
|
| 4 |
+
|
|
|
|
| 5 |
|
| 6 |
from src.negocio.calculo import calculate_mie_arrays
|
| 7 |
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
def descargar_pdf(plot):
|
| 49 |
+
export_svg(plot, filename = "grafica.svg")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
|
mieWeb/src/presentacion/__pycache__/view.cpython-312.pyc
CHANGED
|
Binary files a/mieWeb/src/presentacion/__pycache__/view.cpython-312.pyc and b/mieWeb/src/presentacion/__pycache__/view.cpython-312.pyc differ
|
|
|
mieWeb/src/presentacion/view.py
CHANGED
|
@@ -36,7 +36,8 @@ class View(IView):
|
|
| 36 |
tools="pan,box_zoom,reset,hover",
|
| 37 |
tooltips=[("Wavelength", "@x"), ("Value", "@y")],
|
| 38 |
width=500, # Fixed width
|
| 39 |
-
height=500 # Fixed height
|
|
|
|
| 40 |
)
|
| 41 |
|
| 42 |
# Crear el contenedor para la gr谩fica sin leyenda
|
|
|
|
| 36 |
tools="pan,box_zoom,reset,hover",
|
| 37 |
tooltips=[("Wavelength", "@x"), ("Value", "@y")],
|
| 38 |
width=500, # Fixed width
|
| 39 |
+
height=500, # Fixed height
|
| 40 |
+
output_backend = "svg" # Enable SVG output
|
| 41 |
)
|
| 42 |
|
| 43 |
# Crear el contenedor para la gr谩fica sin leyenda
|
mieWeb/src/test/__pycache__/pruebas.cpython-312.pyc
CHANGED
|
Binary files a/mieWeb/src/test/__pycache__/pruebas.cpython-312.pyc and b/mieWeb/src/test/__pycache__/pruebas.cpython-312.pyc differ
|
|
|
mieWeb/src/test/pruebas.py
CHANGED
|
@@ -1,36 +1,151 @@
|
|
| 1 |
import unittest
|
| 2 |
-
|
| 3 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
from src.negocio.calculo import calculate_mie_arrays
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
class TestPruebas(unittest.TestCase):
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
n_surrounding = 1.0 # 脥ndice de refracci贸n del entorno (agua o aire, por ejemplo)
|
| 21 |
|
| 22 |
-
|
| 23 |
-
results = calculate_mie_arrays(material_data, radius, n_surrounding)
|
| 24 |
|
| 25 |
-
# Arrays de valores reales que tienes
|
| 26 |
-
qext_real = 2
|
| 27 |
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
-
|
|
|
|
| 32 |
|
|
|
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
if __name__ == "__main__":
|
| 36 |
-
unittest.main()
|
|
|
|
| 1 |
import unittest
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
+
import csv
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
|
| 7 |
from src.negocio.calculo import calculate_mie_arrays
|
| 8 |
+
from src.persistencia.acceso_datos import obtener_datos_pagina
|
| 9 |
|
| 10 |
|
| 11 |
class TestPruebas(unittest.TestCase):
|
| 12 |
|
| 13 |
+
|
| 14 |
+
def read_tsv(self, file_name):
|
| 15 |
+
|
| 16 |
+
base_dir = os.path.dirname(os.path.abspath(__file__)) # Carpeta 'test'
|
| 17 |
+
file_path = os.path.join(base_dir, "..", "datos", file_name) # Subir un nivel y entrar en 'datos'
|
| 18 |
+
|
| 19 |
+
data = {
|
| 20 |
+
"Lambda": [],
|
| 21 |
+
"Qext": [],
|
| 22 |
+
"Qsca": [],
|
| 23 |
+
"Qabs": []
|
| 24 |
}
|
| 25 |
|
| 26 |
+
with open(file_path, mode='r') as file:
|
| 27 |
+
reader = csv.reader(file, delimiter='\t')
|
| 28 |
+
|
| 29 |
+
for row in reader:
|
| 30 |
+
data["Lambda"].append(float(row[0]))
|
| 31 |
+
data["Qext"].append(float(row[1]))
|
| 32 |
+
data["Qsca"].append(float(row[2]))
|
| 33 |
+
data["Qabs"].append(float(row[3]))
|
| 34 |
+
|
| 35 |
+
return data
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# Pruebas unitarias para el c谩lculo de Mie
|
| 39 |
+
def test_calculo_mie_1(self):
|
| 40 |
+
|
| 41 |
+
material_1 = obtener_datos_pagina("Ag", "Johnson")
|
| 42 |
+
radius = 25 # Radio de la part铆cula en micr贸metros
|
| 43 |
+
n_surrounding = 1.0 # 脥ndice de refracci贸n del entorno (agua o aire, por ejemplo)
|
| 44 |
+
|
| 45 |
+
results_material = calculate_mie_arrays(material_1, radius, n_surrounding)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
file_name = 'Q_Ag_Johnson_R_25_nmed_1.txt'
|
| 49 |
+
real_data = self.read_tsv(file_name)
|
| 50 |
+
|
| 51 |
+
for real_value, calc_value in zip(real_data["Qext"], results_material["qext"]):
|
| 52 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 53 |
+
|
| 54 |
+
for real_value, calc_value in zip(real_data["Qabs"], results_material["qabs"]):
|
| 55 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 56 |
+
|
| 57 |
+
for real_value, calc_value in zip(real_data["Qsca"], results_material["qsca"]):
|
| 58 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def test_calculo_mie_2(self):
|
| 63 |
+
|
| 64 |
+
material_2 = obtener_datos_pagina("Ag", "Johnson")
|
| 65 |
+
radius = 50 # Radio de la part铆cula en micr贸metros
|
| 66 |
+
n_surrounding = 1.0 # 脥ndice de refracci贸n del entorno (agua o aire, por ejemplo)
|
| 67 |
+
|
| 68 |
+
results_material = calculate_mie_arrays(material_2, radius, n_surrounding)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
file_name = 'Q_Ag_Johnson_R_50_nmed_1.txt'
|
| 72 |
+
real_data = self.read_tsv(file_name)
|
| 73 |
+
|
| 74 |
+
for real_value, calc_value in zip(real_data["Qext"], results_material["qext"]):
|
| 75 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 76 |
+
|
| 77 |
+
for real_value, calc_value in zip(real_data["Qabs"], results_material["qabs"]):
|
| 78 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 79 |
+
|
| 80 |
+
for real_value, calc_value in zip(real_data["Qsca"], results_material["qsca"]):
|
| 81 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 82 |
+
|
| 83 |
+
def test_calculo_mie_3(self):
|
| 84 |
+
|
| 85 |
+
material_3 = obtener_datos_pagina("Au", "Johnson")
|
| 86 |
+
radius = 50 # Radio de la part铆cula en micr贸metros
|
| 87 |
+
n_surrounding = 1.5 # 脥ndice de refracci贸n del entorno (agua o aire, por ejemplo)
|
| 88 |
+
|
| 89 |
+
results_material = calculate_mie_arrays(material_3, radius, n_surrounding)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
file_name = 'Q_Au_Johnson_R_50_nmed_1.5.txt'
|
| 93 |
+
real_data = self.read_tsv(file_name)
|
| 94 |
+
|
| 95 |
+
for real_value, calc_value in zip(real_data["Qext"], results_material["qext"]):
|
| 96 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 97 |
+
|
| 98 |
+
for real_value, calc_value in zip(real_data["Qabs"], results_material["qabs"]):
|
| 99 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 100 |
+
|
| 101 |
+
for real_value, calc_value in zip(real_data["Qsca"], results_material["qsca"]):
|
| 102 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def test_calculo_mie_4(self):
|
| 106 |
+
|
| 107 |
+
material_4 = obtener_datos_pagina("Au", "Johnson")
|
| 108 |
+
radius = 50 # Radio de la part铆cula en micr贸metros
|
| 109 |
+
n_surrounding = 1.0 # 脥ndice de refracci贸n del entorno (agua o aire, por ejemplo)
|
| 110 |
+
|
| 111 |
+
results_material = calculate_mie_arrays(material_4, radius, n_surrounding)
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
file_name = 'Q_Au_Johnson_R_50_nmed_1.txt'
|
| 115 |
+
real_data = self.read_tsv(file_name)
|
| 116 |
+
|
| 117 |
+
for real_value, calc_value in zip(real_data["Qext"], results_material["qext"]):
|
| 118 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 119 |
+
|
| 120 |
+
for real_value, calc_value in zip(real_data["Qabs"], results_material["qabs"]):
|
| 121 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 122 |
+
|
| 123 |
+
for real_value, calc_value in zip(real_data["Qsca"], results_material["qsca"]):
|
| 124 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def test_calculo_mie_5(self):
|
| 129 |
+
|
| 130 |
+
material_5 = obtener_datos_pagina("Au", "Johnson")
|
| 131 |
+
radius = 100 # Radio de la part铆cula en micr贸metros
|
| 132 |
n_surrounding = 1.0 # 脥ndice de refracci贸n del entorno (agua o aire, por ejemplo)
|
| 133 |
|
| 134 |
+
results_material = calculate_mie_arrays(material_5, radius, n_surrounding)
|
|
|
|
| 135 |
|
|
|
|
|
|
|
| 136 |
|
| 137 |
+
file_name = 'Q_Au_Johnson_R_100_nmed_1.txt'
|
| 138 |
+
real_data = self.read_tsv(file_name)
|
| 139 |
|
| 140 |
+
for real_value, calc_value in zip(real_data["Qext"], results_material["qext"]):
|
| 141 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 142 |
|
| 143 |
+
for real_value, calc_value in zip(real_data["Qabs"], results_material["qabs"]):
|
| 144 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 145 |
|
| 146 |
+
for real_value, calc_value in zip(real_data["Qsca"], results_material["qsca"]):
|
| 147 |
+
self.assertAlmostEqual(real_value, calc_value, delta=0.001)
|
| 148 |
|
| 149 |
|
| 150 |
if __name__ == "__main__":
|
| 151 |
+
unittest.main()
|