MTgeophysics / mtpy

Python toolbox for standard Magnetotelluric (MT) data analysis
GNU General Public License v3.0
145 stars 66 forks source link

Error in Impedance function set_res_phase #119

Closed k-a-mendoza closed 4 years ago

k-a-mendoza commented 4 years ago

Building a Z tensor from phase, resistivity and their respective errors is bugged when using set_res_phase

impedance = Z()
impedance.set_res_phase(app_resistivity, phase, frequency_array,app_err,phase_err)

where app_resistivity, phase, app_err, phase_err, are all shaped (30,2,2). frequency array is shaped (30), yet I'm getting a broadcast error in z.py line 73:

File "../anaconda3/envs/mtpy/lib/python3.7/site-packages/mtpy/core/z.py", line 173, in set_res_phase
abs_z = np.sqrt(5.0 * self.freq * self.resistivity)

ValueError: operands could not be broadcast together with shapes (30,) (30,2,2)
alkirkby commented 4 years ago

Hi, I've just fixed this broadcasting error. See how you go.