Utils
These functions are used within the various experiment classes and it's unlikely you'll need them while performing data analysis using magnetopy
. Future development of new classes for new experiments may find these useful, though.
add_uncorrected_moment_columns(experiment)
DataFrame
s from .dat files containing dc data have different columns for the
moment depending on whether the measurement was done in VSM or DC mode. This
function adds a column called "uncorrected_moment" and "uncorrected_moment_err"
that contains the moment and moment error from the .dat file, regardless of
whether the measurement was done in VSM or DC mode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment |
DcExperiment
|
A |
required |
Source code in magnetopy\experiments\utils.py
scale_dc_data(experiment, mass=0, eicosane_mass=0, molecular_weight=0, diamagnetic_correction=0)
Adds columns to the data
attribute of a DcExperiment
object that contain
the magnetic moment, magnetic susceptibility, and magnetic susceptibility times
temperature. The columns added are "moment"
, "moment_err"
, "chi"
,
"chi_err"
, "chi_t"
, and "chi_t_err"
. The units of these values depend on
the values of the mass
, eicosane_mass
, molecular_weight
, and
diamagnetic_correction
. A record of what scaling was applied is added to the
scaling
attribute of the DcExperiment
object.
Here are the currently supported scaling options:
-
If
mass
is given but notmolecular_weight
, the only available scaling is a mass correction. -
If
mass
andmolecular
weight are given, a molar correction is applied. The molar correction can be further modified by givingeicosane_mass
and/ordiamagnetic_correction
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment |
DcExperiment
|
A |
required |
mass |
float
|
mg of sample, by default 0. |
0
|
eicosane_mass |
float
|
mg of eicosane, by default 0. |
0
|
molecular_weight |
float
|
Molecular weight of the material in g/mol, by default 0. |
0
|
diamagnetic_correction |
float
|
Diamagnetic correction of the material in cm^3/mol, by default 0. |
0
|
Source code in magnetopy\experiments\utils.py
num_digits_after_decimal(number)
Return the number of digits after the decimal point in a number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number |
int | float
|
|
required |
Returns:
Type | Description |
---|---|
int
|
The number of digits after the decimal point in the number. |