qass-tools-micromagnetic 0.1.0
Micromagnetic toolkit
Requires Python: >=3.6

# Micromagnetic Package for Qass Tools

Analysis Package for Barkhausen Noise Data.

## Install as developer

Install the newest version of the pip package by:

```sh
pip install qass-tools-micromagnetic --user -e .[developers]
```

## How to import the package

```py
from qass.tools import micromagnetic
```

or to directly address micromagnetic.py:

```py
import qass.tools.micromagnetic.micromagnetic as micromagnetic
```

and/or take usage of the corresponding visualization package:

```py
from qass.tools.micromagnetic import micromagnetic_visualization 
```

## How to use micromangetic package

```py
""" The QASS TOOLS MICROMAGNETIC package is used to analysis Barhausen Noise specific Buffer and store examined data. Therefore we always need a buffer to analyis."""
from qass.tools.analyzer.buffer_parser import Buffer
from qass.tools.analyzer.buffer_metadata_cache import BufferMetadataCache as BMC, BufferMetadata as BM, select
from qass.tools.micromagnetic import micromagnetic 

############ GET BUFFERs TO ANALYSE
FIRST_PROCESS    = 1241 
LAST_PROCESS     = 1901 

energy_buffers = cache.get_matching_buffers(query=select(BM).filter(BM.channel  == 1, 
                                                           BM.datamode == Buffer.DATAMODE.DATAMODE_FFT,
                                                           BM.datatype == Buffer.DATATYPE.COMP_RAW,
                                                           BM.process <= int(LAST_PROCESS),
                                                           BM.process >= int(FIRST_PROCESS)).order_by(BM.process))

representer = []
procs = []

############ LOAD IN BUFFER AND CALCULATE REPRESENTER
for buffer in barkhausen_buffer:
    with buffer as buff:
        start_time = 0
        fft = buff.get_data() * buff.refEnergy
        
        rep = micromagnetic.create_representer(fft_data=fft, start_spec=start_time, spec_duration_ns=buff.spec_duration, stim_frq=200, stim_amp=700, frq_per_band=buff.frq_per_band, compression_frq=1, compression_time=1)

        representer.append(rep)
        procs.append(buff.process)

############ EVERY REPRESENTER IN LIST IS FROM TYPE DATACLASS AND HOLDS ALL IMPORTANT INFORMATION FOR THE PROCESS
### OFFICIAL REPRESENTER METHOD SHOWS ALL AVAIBLE METADATA
print(representer[0])
# OUTPUT: fft_data=(625, 512), stim_frq=200, stim_amp=700, spec_duration=[8000.], compression_time=1, compression_frq=1, start_time=0.0, offset_roll=-238, frq_per_band=3906.0

############ EACH REPRESENTER DIRECTLY PLOTS THESELVES
representer[0].imshow_representer()
representer[0].plot_3D_representer()
representer[0].imshow_spline_representer()
```

```py
""" BY EXAMINE ADDITIONAL DATA CHANNELS FROM QASS µMAGNETIC SENSOR, MORE INFORMATION CAN BE GATHERED."""
from qass.tools.analyzer.buffer_parser import Buffer
from qass.tools.analyzer.buffer_metadata_cache import BufferMetadataCache as BMC, BufferMetadata as BM, select
from qass.tools.micromagnetic import micromagnetic 

############ GET BUFFERS TO ANALYSE
FIRST_PROCESS    = 1241 
LAST_PROCESS     = 1901 
# CONSTANTS
STIM_FREQUNECY   = 200
STIM_AMPLITUDE   = 955


hysteresis = micromagnetic.create_hysteresis(flux_bit_ADC, spec_duration_flux_bit_ADC, current_bit_ADC, spec_duration_i_bit_ADC, 200, 955)
hysteresis.plot_hysteresis(zero_axis=True)