scilens 0.3.15__py3-none-any.whl → 0.3.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scilens/config/models/reader_format_cols.py +1 -1
- scilens/readers/reader_csv.py +4 -3
- scilens/readers/reader_txt_fixed_cols.py +19 -16
- {scilens-0.3.15.dist-info → scilens-0.3.17.dist-info}/METADATA +1 -1
- {scilens-0.3.15.dist-info → scilens-0.3.17.dist-info}/RECORD +7 -7
- {scilens-0.3.15.dist-info → scilens-0.3.17.dist-info}/WHEEL +0 -0
- {scilens-0.3.15.dist-info → scilens-0.3.17.dist-info}/entry_points.txt +0 -0
|
@@ -16,4 +16,4 @@ class ReaderColsCurveParserConfig(BaseModel):
|
|
|
16
16
|
elif A.name==ReaderCurveParserNameConfig.COLS_COUPLE:A.parameters=ReaderCurveParserColsCoupleConfig(**A.parameters)
|
|
17
17
|
return A
|
|
18
18
|
class ReaderColsRowsConfig(BaseModel):ignore_patterns:list[str]|_A=Field(default=_A,description='Liste des patterns de lignes à ignorer. Ex: ["^#", "^//"]. Non applicable si `is_matrix` est vrai.');line_start:int|_A=Field(default=_A,description='Ligne de début pour lire le fichier (les en-têtes sont comptées comme une ligne). Si non défini, commence à la première ligne.');line_end:int|_A=Field(default=_A,description="Ligne de fin pour lire le fichier (les en-têtes sont comptées comme une ligne). Si non défini, lit jusqu'à la dernière ligne.");index_min_value:float|_A=Field(default=_A,description="Valeur minimale de l'index pour les lignes à lire (valeur incluses).");index_max_value:float|_A=Field(default=_A,description="Valeur maximale de l'index pour les lignes à lire (valeur incluses).")
|
|
19
|
-
class ReaderColsConfig(BaseModel):ignore_columns:list[str]|_A=Field(default=_A,description=
|
|
19
|
+
class ReaderColsConfig(BaseModel):ignore_columns:list[str]|list[int]|_A=Field(default=_A,description="Liste des colonnes à ignorer (nom de l'en tête ou numéro de colonne).");index_col:int|str|_A=Field(default=_A,description='Colonne à utiliser comme index (date/heure, itération, étape, ...) (Utilisé dans différentes règles). Numéro de colonne ou nom de colonne. (Valide seulement si non matrice)');rows:ReaderColsRowsConfig|_A=Field(default=_A,description='Configuration des lignes à lire.');curve_parser:ReaderColsCurveParserConfig|_A=Field(default=_A,description='Parseur de courbe à utiliser.')
|
scilens/readers/reader_csv.py
CHANGED
|
@@ -53,7 +53,8 @@ class ReaderCsv(ReaderInterface):
|
|
|
53
53
|
else:
|
|
54
54
|
if C.cols and C.cols.ignore_columns:
|
|
55
55
|
if not F:raise Exception('Ignore columns is not supported without header.')
|
|
56
|
-
A.numeric_col_indexes=[B for B in A.numeric_col_indexes if A.cols[B]not in C.cols.ignore_columns]
|
|
56
|
+
if isinstance(C.cols.ignore_columns[0],str):A.numeric_col_indexes=[B for B in A.numeric_col_indexes if A.cols[B]not in C.cols.ignore_columns]
|
|
57
|
+
if isinstance(C.cols.ignore_columns[0],int):V=[A-1 for A in B.ignore_columns];A.numeric_col_indexes=[A for A in A.numeric_col_indexes if A not in V]
|
|
57
58
|
S=len(I);D=ColsDataset(cols_count=S,names=I,numeric_col_indexes=A.numeric_col_indexes,data=[[]for A in range(S)]);E=0
|
|
58
59
|
if F and E==0:next(J);E+=1
|
|
59
60
|
if L:
|
|
@@ -78,8 +79,8 @@ class ReaderCsv(ReaderInterface):
|
|
|
78
79
|
if C.metrics:A.metrics=D.compute_metrics(C.metrics)
|
|
79
80
|
if C.cols and C.cols.curve_parser:
|
|
80
81
|
if C.cols.curve_parser.name==ReaderCurveParserNameConfig.COL_X:
|
|
81
|
-
A.curves,
|
|
82
|
-
if A.curves:A.cols_curve=ColsCurves(type=ReaderCurveParserNameConfig.COL_X,info=
|
|
82
|
+
A.curves,W=D.get_curves_col_x(C.cols.curve_parser.parameters.x)
|
|
83
|
+
if A.curves:A.cols_curve=ColsCurves(type=ReaderCurveParserNameConfig.COL_X,info=W,curves=A.curves)
|
|
83
84
|
elif C.cols.curve_parser.name==ReaderCurveParserNameConfig.COLS_COUPLE:raise NotImplementedError('cols_couple not implemented')
|
|
84
85
|
else:raise Exception('Curve parser not supported.')
|
|
85
86
|
def compare(A,compare_floats,param_reader,param_is_ref=_B):
|
|
@@ -51,34 +51,37 @@ class ReaderTxtFixedCols(ReaderInterface):
|
|
|
51
51
|
return C
|
|
52
52
|
def _derive_col_indexes(A,header_row=_A):0
|
|
53
53
|
def read(A,reader_options):
|
|
54
|
-
B=reader_options;A.reader_options=B;A.ignore_lines_patterns=_A;I=_A;K=_A;
|
|
55
|
-
if
|
|
56
|
-
if
|
|
57
|
-
F=A._get_parsed_headers(A.origin.path)if B.has_header else _A;L=open(A.origin.path,'r',encoding=A.encoding);
|
|
54
|
+
B=reader_options;A.reader_options=B;A.ignore_lines_patterns=_A;I=_A;K=_A;D=B.cols
|
|
55
|
+
if D:
|
|
56
|
+
if D.rows:A.ignore_lines_patterns=D.rows.ignore_patterns;I=D.rows.line_start;K=D.rows.line_end
|
|
57
|
+
F=A._get_parsed_headers(A.origin.path)if B.has_header else _A;L=open(A.origin.path,'r',encoding=A.encoding);E=[]
|
|
58
58
|
if B.column_indexes or B.column_widths:
|
|
59
59
|
if B.column_indexes and B.column_widths:raise Exception('column_indexes and column_widths are exclusive.')
|
|
60
60
|
if B.column_widths:
|
|
61
61
|
logging.debug(f"Using column widths: {B.column_widths}");J=0
|
|
62
|
-
for M in B.column_widths:
|
|
63
|
-
else:logging.debug(f"Using column indexes: {B.column_indexes}");
|
|
64
|
-
else:logging.debug(f"Using auto derived column indexes.");P=A._get_first_data_line(A.origin.path);
|
|
65
|
-
logging.debug(f"Column indexes: {
|
|
66
|
-
if not
|
|
67
|
-
G=len(
|
|
68
|
-
if F:
|
|
62
|
+
for M in B.column_widths:E+=[(J,J+M)];J+=M
|
|
63
|
+
else:logging.debug(f"Using column indexes: {B.column_indexes}");E=B.column_indexes
|
|
64
|
+
else:logging.debug(f"Using auto derived column indexes.");P=A._get_first_data_line(A.origin.path);E=A._discover_col_idx_ralgin_spaces(P)
|
|
65
|
+
logging.debug(f"Column indexes: {E}")
|
|
66
|
+
if not E:raise Exception('No column indexes or widths provided, and no headers found to derive column indexes.')
|
|
67
|
+
G=len(E);C=ColsDataset(cols_count=G,names=[f"Column {A+1}"for A in range(G)],numeric_col_indexes=[A for A in range(G)],data=[[]for A in range(G)])
|
|
68
|
+
if F:C.names=F.data
|
|
69
|
+
if D and D.ignore_columns:
|
|
70
|
+
if isinstance(D.ignore_columns[0],str):C.numeric_col_indexes=[A for A in C.numeric_col_indexes if C.names[A]not in D.ignore_columns]
|
|
71
|
+
if isinstance(D.ignore_columns[0],int):Q=[A-1 for A in D.ignore_columns];C.numeric_col_indexes=[A for A in C.numeric_col_indexes if A not in Q]
|
|
69
72
|
H=I or 0
|
|
70
73
|
for N in islice(L,I,K):
|
|
71
74
|
H+=1
|
|
72
75
|
if A._ignore_line(N):continue
|
|
73
76
|
if F:
|
|
74
77
|
if F.ori_line_idx==H-1:continue
|
|
75
|
-
for(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
for(R,O)in enumerate(E):S=N[O[0]:O[1]].strip();T=string_2_float(S);C.data[R].append(T)
|
|
79
|
+
C.origin_line_nb.append(H)
|
|
80
|
+
C.rows_count=len(C.origin_line_nb);L.close();A.cols_dataset=C;A.raw_lines_number=H;A.curves=_A;A.cols_curve=_A
|
|
78
81
|
if B.cols and B.cols.curve_parser:
|
|
79
82
|
if B.cols.curve_parser.name==ReaderCurveParserNameConfig.COL_X:
|
|
80
|
-
A.curves,
|
|
81
|
-
if A.curves:A.cols_curve=ColsCurves(type=ReaderCurveParserNameConfig.COL_X,info=
|
|
83
|
+
A.curves,U=C.get_curves_col_x(B.cols.curve_parser.parameters.x)
|
|
84
|
+
if A.curves:A.cols_curve=ColsCurves(type=ReaderCurveParserNameConfig.COL_X,info=U,curves=A.curves)
|
|
82
85
|
elif B.cols.curve_parser.name==ReaderCurveParserNameConfig.COLS_COUPLE:raise NotImplementedError('cols_couple not implemented')
|
|
83
86
|
else:raise Exception('Curve parser not supported.')
|
|
84
87
|
def compare(A,compare_floats,param_reader,param_is_ref=True):D=param_is_ref;C=param_reader;B=compare_floats;E=A.cols_dataset if D else C.cols_dataset;F=A.cols_dataset if not D else C.cols_dataset;G=A.cols_curve;I,H=B.compare_errors.add_group('node','txt cols');return compare(H,B,E,F,G)
|
|
@@ -27,7 +27,7 @@ scilens/config/models/compare_float_thresholds.py,sha256=mHu48-70i3o_qUw6x-1A7Xe
|
|
|
27
27
|
scilens/config/models/execute.py,sha256=Hx3DoDJ0fq7bZruqwtPtSKL6PVOF_LpsaDCLrn5klLk,2325
|
|
28
28
|
scilens/config/models/execute_and_compare.py,sha256=TWL6yXGvQSaaV6nhHqWLvtr3v396APIoDNt0U1TbMro,582
|
|
29
29
|
scilens/config/models/file_reader.py,sha256=c18vKhVcBX4ufpbnCBJyVyAsQtlxpwx0lGVuf1i8EGA,1176
|
|
30
|
-
scilens/config/models/reader_format_cols.py,sha256=
|
|
30
|
+
scilens/config/models/reader_format_cols.py,sha256=Ec6K52pNvwRAPmgCnq87qSmG2wAZIz4lrGZBgOp4-3k,3295
|
|
31
31
|
scilens/config/models/reader_format_csv.py,sha256=zxysiAAQitdBjh1mTlzQR0YafmLyIdEm2qarNh98ST8,1590
|
|
32
32
|
scilens/config/models/reader_format_netcdf.py,sha256=k-AMdm239T6I42R8jzyRlPKKJ8zkRrN8XS8yU6ZkFu0,1256
|
|
33
33
|
scilens/config/models/reader_format_txt.py,sha256=eHg90gwEI_VpqwqEjMRhwlS8dHcl5G4ow-37HjQq_zY,1168
|
|
@@ -52,11 +52,11 @@ scilens/readers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
52
52
|
scilens/readers/cols_dataset.py,sha256=KENQLhlAjktOTPymqokJLp_mBOsMFq8GRy_cs9b3wjU,3151
|
|
53
53
|
scilens/readers/exceptions.py,sha256=JzmxcjnR5sH-IOWVeCC5A1bSwxv-jCAtIJvDjzx1CTI,32
|
|
54
54
|
scilens/readers/mat_dataset.py,sha256=Z9TYDWaH2aqdniLNDjlpR6VVNHMSARjh52clhdMyOn4,1496
|
|
55
|
-
scilens/readers/reader_csv.py,sha256=
|
|
55
|
+
scilens/readers/reader_csv.py,sha256=yCaJGxG9xow1BUUavdSVJKKl8nRRUtfYMk_sYkOW4-U,5470
|
|
56
56
|
scilens/readers/reader_interface.py,sha256=nnttHL7wt4MOXpi-SBkk8DYxVWscOPG8JFl_z12mIAo,922
|
|
57
57
|
scilens/readers/reader_manager.py,sha256=DFinxIk3IIIcB6JxybGcv-mXt3jhXgCwUtzR0TqhB2Q,2684
|
|
58
58
|
scilens/readers/reader_txt.py,sha256=WPsFunEA_idzAKkD3UJQbLnaOzG2U03P3gY4gphuIw0,3868
|
|
59
|
-
scilens/readers/reader_txt_fixed_cols.py,sha256=
|
|
59
|
+
scilens/readers/reader_txt_fixed_cols.py,sha256=Ec4J34M770akw8i07BC2zahVuS8pezP31BsHoS4NyNE,4528
|
|
60
60
|
scilens/readers/transform.py,sha256=kppfgPkXymF0qtquFivuosLVfF66L9bE-wGx-3bMHv8,307
|
|
61
61
|
scilens/report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
62
|
scilens/report/assets/logo.svg,sha256=W-1OVqcvdBjf-1AHHcV6WciIUqBoVFUh52Tc3o_jqtA,4519
|
|
@@ -106,7 +106,7 @@ scilens/utils/template.py,sha256=9dlXX3nmfzDRUwzPJOkoxk15UXivZ2SW-McdCwokFa4,443
|
|
|
106
106
|
scilens/utils/time_tracker.py,sha256=DdVBoMpVLXrX0qZZXyLm4g38EwDVLlRcBqcpNex1mYY,545
|
|
107
107
|
scilens/utils/vectors.py,sha256=4N2BZSC5n3HgZqPujDGF5NdjVmSL1rOHb_qw4OoABQY,103
|
|
108
108
|
scilens/utils/web.py,sha256=MAFWpIFOKz7QhqDoFh-Qwstvc76KpcxstSgHFT8FOL4,901
|
|
109
|
-
scilens-0.3.
|
|
110
|
-
scilens-0.3.
|
|
111
|
-
scilens-0.3.
|
|
112
|
-
scilens-0.3.
|
|
109
|
+
scilens-0.3.17.dist-info/METADATA,sha256=tX3b33HPV3YagW6cajcyuH0_IbuZXB7PClcNkXNBA7c,1368
|
|
110
|
+
scilens-0.3.17.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
111
|
+
scilens-0.3.17.dist-info/entry_points.txt,sha256=DaKGgxUEUv34GJAoXtta6ecL37ercejep9sCSSRQK2s,48
|
|
112
|
+
scilens-0.3.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|