MicEMD.handler package

Submodules

MicEMD.handler.handler module

class MicEMD.handler.handler.FDEMHandler(**kwargs)

Bases: MicEMD.handler.handler.FDEMBaseHandler

The class is used to handle the results of the simulation and inversion

kwargs: optional

if there is para, the para is used to create the default dir of saving files

get_save_fdem_dir:

to create the file path by parameters about this target scene

save_fwd_data:

save the observed data that simulating by forward simulation

save_inv_res:

save the inversion result by custom path

save_fwd_data_default:

according to the default path to save the forward data

save_inv_res_default:

according to the default path to save the forward data

show_detection_scenario:

show the detection scenario

show_mag_map:

show the secondary field strength of some axis

show_inv_res:

show the inversion results in line chart and bar chart

show_detection_scenario_default:

according to the default path to save the scenerio

show_mag_map_default:

according to the default path to save the mag map

show_inv_res_default:

according to the default path to save the result display chart

get_save_fdem_dir()

to get the parameters about this target scene to make file save the data about fdem_forward_simulation

file_namestr

the file name to save the data about fdem_forward_simulation and fdem_inversion

save_forward()
save_fwd_data(data, file_name=None)

save the data of the forward_res the function to save the forward res

data: ndarray

conclude the receiver location and magnetic data

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/fdemResults/forward_res’,if you just input the file name, it will be saved in the path

save_fwd_data_default(loc_mag)

the mag_data(contained the detection position and secondary field data) saved by ‘.xls’ file.

file_namestr

the specific path of the fdem_results. the path named by the parameters of the detection scene

None.

save_inv()
save_inv_res(inv_res, file_name)

save the inversion result

inv_res: dict

the res of the inversion, conclude the error, the true value and the pred value

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/fdemResults/inverse_res’,if you just input the file name, it will be saved in the path

save_inv_res_default(inv_res, method)

the inv_result(contained the true properties,estimate properties and errors between them) saved by ‘.xls’ file named by the optimization algorithm name + ‘_invResult’

file_namestr

the specific path of the fdem_results. the path named by the parameters of the detection scene

None.

show_detection_scenario(Target, Collection, show=False, save=False, file_name=None, fig=None)

in 3D ax show the detection scene,the main part is to show the metal cylinder with different posture,the posture of the metal cylinder can be showed by the rotation matrix

targetclass Target

Contains the parameters of the target.

collectionclass Collection

Contains the parameters of the collection process.

show: bool

whether to show the fig

save: bool

whether to save the fig

file_name: str

if save is true, the file path to save, it is ‘../results/fdemResults/forward_res’ defaultly

figmatplotlib.figure.Figure

it is None defaultly

show_detection_scenario_default(fig=None, show=True, save=True)

in 3D ax show the detection scene,the main part is to show the metal cylinder with different posture,the posture of the metal cylinder can be showed by the rotation matrix

figmatplotlib.figure.Figure

Empty figure.

targetclass Target

Contains the parameters of the target.

collectionclass Collection

Contains the parameters of the collection process.

None.

show_discretize(mesh, mapped_model, Collection, Target, show=False, save=False, file_name=None, fig=None)
show_discretize_default(mesh, mapped_mode, fig=None, show=True, save=True)
show_inv_res(inv_res, show=False, save=False, file_name=None, fig=None)
show_inv_res_default(inv_res, fig=None, show=True, save=True)
show_mag_map(loc_mag, Collection, show=False, save=False, file_name=None, fig=None)

show the magnetic field map

figmatplotlib.figure.Figure

Empty figure.

receiver_locationsnumpy.ndarray, shape(N*3)

See fdem_forward_simulation.fdem_forward_simulation receiver_locations.

mag_datanumpy.ndarray, shape(N*1)

See fdem_forward_simulation.fdem_forward_simulation mag_data.

None.

show_mag_map_default(loc_res, fig=None, show=True, save=True)
figmatplotlib.figure.Figure

Empty figure.

receiver_locationsnumpy.ndarray, shape(N*3)

See fdem_forward_simulation.fdem_forward_simulation receiver_locations.

mag_datanumpy.ndarray, shape(N*1)

See fdem_forward_simulation.fdem_forward_simulation mag_data.

None.

class MicEMD.handler.handler.TDEMHandler(**kwargs)

Bases: MicEMD.handler.handler.TDEMBaseHandler

The class is used to handle the results of the simulation and classification

kwargs: optional

if there is para, the para is used to create the default dir of saving files

get_save_tdem_dir:

to create the file path by parameters about this target scene

save_fwd_data:

save the observed data that simulating by forward simulation

save_sample_data:

save the sample data of the fwd_data

save_fwd_data_default:

according to the default path to save the forward data

save_sample_data_default:

according to the default path to save the sample data

save_preparation_default:

save the pre-processed data

save_dim_reduction_default:

save the data after dimension reduction according to the default path

plot_confusion_matrix:

plot the result of classification

plot_confusion_matrix_default:

plot the result of classification according to the default path

plot_data:

plot the sample data

get_save_tdem_dir()

to get the parameters about this target scene to make file save the data about fdem_forward_simulation

file_namestr

the file name to save the data about fdem_forward_simulation and fdem_inversion

save_cls_res(cls_res, file_name)

save the classification result

cls_res: dict

the res of the classification, conclude the accuracy, the true value and the pred value

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/tdemResults/classify_res’,if you just input the file name, it will be saved in the path

save_cls_res_default(cls_res)

save the classification result defaultly

cls_res: dict

the res of the classification, conclude the accuracy, the true value and the pred value

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/tdemResults/classify_res’,if you just input the file name, it will be saved in the path

save_dim_reduction_default(train_set, test_set, task, dim_method)
save_fwd_data(response, file_name=None)

save the data of the forward_res the function as the general save function of the forward res

response: ndarry

the dataset to save

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/tdemResults/forward_res’,if you just input the file name, it will be saved in the path

save_fwd_data_default(response)

save the data of the forward_res the function as the general save function of the forward res

response: ndarry

the dataset to save

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/tdemResults/forward_res’,if you just input the file name, it will be saved in the path

save_preparation_default(train_set, test_set, task)
save_sample_data(sample, file_name, show=False)

save the sample data of the forward_res

sample: ndarry

the dataset to save

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/tdemResults/forward_res’,if you just input the file name, it will be saved in the path

show: bool

show the picture of the sample data

save_sample_data_default(sample, fig=None, show=True, save=True)

save the sample data of the forward_res

sample: ndarry

the dataset to save

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/tdemResults/forward_res’,if you just input the file name, it will be saved in the path

show: bool

show the picture of the sample data

show_cls_res(cls_res, type, fig=None, show=False, save=False, file_name=None)

This function prints and plots the confusion matrix. Normalization can be applied by setting normalize=True. Parameters: ———– type: list

the list of classification types

show: bool

whether to show

save: bool

whether to save

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/tdemResults/classify_res’,if you just input the file name, it will be saved in the path, if you don’t input the file name, it will be saved by the name ‘cls_res.pdf’

show_cls_res_default(cls_result, task, fig=None, show=False, save=True)

This function prints and plots the confusion matrix. Normalization can be applied by setting normalize=True.

show_sample_data(M1, M2, M1_without_noise, M2_without_noise, t, SNR, material, ta, tb, file_name=None, show=False, fig=None)

show the sample data

M1: ndarry

the M1 response of the target

M2: ndarry

the M2 response of the target

M1_without_noise: ndarry

the M1 response of the target without the noise

M2_without_noise: ndarry

the M2 response of the target without the noise

t: int

the times collected per second

SNR: int

SNR(Signal to Noise Ratio)

material: str

the material of the target of the sample

ta: int

the radial radius of the target of the sample

tb: int

the axial radius of the target of the sample

file_name: str

the name of the file that you want to save, the Default relative path is ‘../results/tdemResults/forward_res’,if you just input the file name, it will be saved in the path

show: bool

whether to show the picture

Module contents