@@ -41,10 +41,40 @@ def __init__(self, dataframe, **kwargs):
41
41
"z_xy" : {"simpeg" : "zyx" , "z+" : "z_xy" },
42
42
"z_yx" : {"simpeg" : "zxy" , "z+" : "z_yx" },
43
43
"z_yy" : {"simpeg" : "zxx" , "z+" : "z_yy" },
44
- "t_zx" : {"simpeg" : "zzy " , "z+" : "z_zx " },
45
- "t_zy" : {"simpeg" : "zzx " , "z+" : "z_zy " },
44
+ "t_zx" : {"simpeg" : "tzy " , "z+" : "t_zx " },
45
+ "t_zy" : {"simpeg" : "tzx " , "z+" : "t_zy " },
46
46
}
47
47
48
+ self ._component_list = list (self .component_map .keys ())
49
+
50
+ self ._rec_columns = {
51
+ "frequency" : "freq" ,
52
+ "east" : "x" ,
53
+ "north" : "y" ,
54
+ "elevation" : "z" ,
55
+ }
56
+ self ._rec_columns .update (
57
+ dict (
58
+ [
59
+ (key , self .component_map [key ]["simpeg" ])
60
+ for key in self ._component_list
61
+ ]
62
+ )
63
+ )
64
+
65
+ self ._rec_dtypes = [
66
+ ("freq" , float ),
67
+ ("x" , float ),
68
+ ("y" , float ),
69
+ ("z" , float ),
70
+ ("zxx" , complex ),
71
+ ("zxy" , complex ),
72
+ ("zyx" , complex ),
73
+ ("zyy" , complex ),
74
+ ("tzx" , complex ),
75
+ ("tzy" , complex ),
76
+ ]
77
+
48
78
self .include_elevation = False
49
79
self .topography = None # should be a geotiff or asc file
50
80
self .geographic_coordinates = True
@@ -55,8 +85,6 @@ def __init__(self, dataframe, **kwargs):
55
85
self .invert_t_zx = True
56
86
self .invert_t_zy = True
57
87
58
- self ._component_list = list (self .component_map .keys ())
59
-
60
88
@property
61
89
def station_locations (self ):
62
90
"""
@@ -77,7 +105,7 @@ def station_locations(self):
77
105
np .zeros (station_df .elevation .size ),
78
106
]
79
107
80
- def frequecies (self ):
108
+ def frequencies (self ):
81
109
"""unique frequencies from the dataframe"""
82
110
83
111
return 1.0 / self .dataframe .period .unique ()
@@ -180,21 +208,13 @@ def get_survey(self, index):
180
208
def to_rec_array (self ):
181
209
182
210
df = self .dataframe [
183
- ["period" , "east" , "north" , "elevation" ] + self .component_map
211
+ ["period" , "east" , "north" , "elevation" ] + self ._component_list
184
212
]
185
213
186
- df [ "freq " ] = 1.0 / df .period
214
+ df . loc [:, "frequency " ] = 1.0 / df .period . to_numpy ()
187
215
df = df .drop (columns = "period" )
216
+ new_column_names = [self ._rec_columns [col ] for col in df .columns ]
217
+ df .columns = new_column_names
218
+ df = df [[col [0 ] for col in self ._rec_dtypes ]]
188
219
189
- df .rename (
190
- columns = {"east" : "x" , "north" : "y" , "elevation" : "z" }.update (
191
- dict (
192
- [
193
- (key , self .component_map [key ]["simpeg" ])
194
- for key in self ._component_list
195
- ]
196
- )
197
- )
198
- )
199
-
200
- return df .to_recarray ()
220
+ return df .to_records (index = False , column_dtypes = dict (self ._rec_dtypes ))
0 commit comments