4
4
import dataclasses
5
5
import numpy as np
6
6
7
- from gempy .core .data .core_utils import calculate_line_coordinates_2points
8
- from gempy .optional_dependencies import require_pandas
7
+ from ..core_utils import calculate_line_coordinates_2points
8
+ from ..encoders .converters import short_array_type
9
+ from ....optional_dependencies import require_pandas
9
10
10
11
try :
11
12
import pandas as pd
12
13
except ImportError :
13
14
pandas = None
14
15
15
16
16
- @dataclasses .dataclass
17
- class SectionDefinition :
18
- """
19
- A single cross‐section’s raw parameters.
20
- """
21
- start : Tuple [float , float ]
22
- stop : Tuple [float , float ]
23
- resolution : Tuple [int , int ]
24
-
25
-
26
17
@dataclasses .dataclass
27
18
class Sections :
28
19
"""
@@ -40,18 +31,25 @@ class Sections:
40
31
41
32
# user‐provided inputs
42
33
43
- z_ext : Tuple [float , float ]
44
- section_dict : Dict [str , tuple [list [int ]]]
34
+ z_ext : Tuple [float , float ] | short_array_type
35
+ section_dict : Dict [
36
+ str ,
37
+ Tuple [
38
+ Tuple [float , float ], # start
39
+ Tuple [float , float ], # stop
40
+ Tuple [int , int ] # resolution
41
+ ]
42
+ ]
45
43
46
44
# computed/internal (will be serialized too unless excluded)
47
- names : List [str ] = Field (default_factory = list )
48
- points : List [List [Tuple [float , float ]]] = Field (default_factory = list )
49
- resolution : List [Tuple [int , int ]] = Field (default_factory = list )
50
- length : np .ndarray = Field (default_factory = lambda : np .array ([0 ]), exclude = False )
51
- dist : np .ndarray = Field (default_factory = lambda : np .array ([]), exclude = False )
52
- df : Optional [pd .DataFrame ] = Field (default_factory = None , exclude = False )
53
- values : np .ndarray = Field (default_factory = lambda : np .empty ((0 , 3 )), exclude = False )
54
- extent : Optional [np .ndarray ] = None
45
+ names : List [str ] = Field (default_factory = list , exclude = True )
46
+ points : List [List [Tuple [float , float ]]] = Field (default_factory = list , exclude = True )
47
+ resolution : List [Tuple [int , int ]] = Field (default_factory = list , exclude = True )
48
+ length : np .ndarray = Field (default_factory = lambda : np .array ([0 ]), exclude = True )
49
+ dist : np .ndarray = Field (default_factory = lambda : np .array ([]), exclude = True )
50
+ df : Optional [pd .DataFrame ] = Field (default = None , exclude = True )
51
+ values : np .ndarray = Field (default_factory = lambda : np .empty ((0 , 3 )), exclude = True )
52
+ extent : Optional [np .ndarray ] = Field ( default = None , exclude = True )
55
53
56
54
# def __init__(self, regular_grid=None, z_ext=None, section_dict=None):
57
55
# pd = require_pandas()
@@ -75,12 +73,13 @@ class Sections:
75
73
# self.set_sections(section_dict)
76
74
def __post_init__ (self ):
77
75
self .initialize_computations ()
76
+ pass
78
77
79
78
# @model_validator(mode="after")
80
79
# def init_class(self):
81
80
# self.initialize_computations()
82
81
# return self
83
-
82
+ #
84
83
def initialize_computations (self ):
85
84
# copy names
86
85
self .names = list (self .section_dict .keys ())
0 commit comments