ubermag / help

Repository for raising issues and requesting help on Ubermag
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

Data associated with each cell #111

Closed MehranSedrpooshan closed 3 years ago

MehranSedrpooshan commented 3 years ago

Dear Ubermag team or users,

How can I extract the raw data associated with each cell? For example, mx, my, mz for each cell after using hysteresisdriver (for each stage). I can get for example "mx" by passing "system.table.data.mx", but the value is related to the whole of the system.

Thank you so much!

marijanbeg commented 3 years ago

Hi @MehranSedrpooshan, thank you for your question and for using Ubermag. Table data shows average magnetisation. If you need a magnetisation field, you can access it by:

import micromagneticdata as md
data = md.Data(name=system.name)
drive = data[-1]
m = drive[N]  # replace N with the step number

You can find more information here: https://github.com/ubermag/workshop/blob/master/tutorials/hysteresis.ipynb

sediEmad commented 3 years ago

Hi everyone, I think by using the center coordinate of cells ( list(mesh) ) and then system.m(point), we can get the magnetization of each cell.

cell_center_pos = list(mesh) # This extracts cell centre points M_list = [] for point in cell_center_pos: M_cell = system.m(point) M_list.append(M_cell) print(M_list)