simple.norm
simple.norm.IntNormMethods
module-attribute
IntNormMethods = {}
simple.norm.internal_normalisation
internal_normalisation(abu, isotopes, normrat, stdmass, stdabu, enrichment_factor=1, relative_enrichment=True, std_enrichment_factor=1, std_relative_enrichment=True, method='largest_offset', *, msg_prefix='', **method_kwargs)
Normalise the abundances of abu
relative to the keys normrat
using the internal normalisation procedure
commonly used for data measured by mass spectrometers.
Multiple normalisations can be done at once by supplying a list of normalising isotopes. If doing multiple
elements at once then isotopes
, if not None
, and optionally enrichment_factor
and
std_enrichement_factor
, must be lists with the same
length as normiso
. If enrichment_factor
/std_enrichment_factor
is a single value it is applied to
all elements.
Parameters:
-
abu
–A keyarray containing the abundances to be normalised.
-
isotopes
–The numerator isotopes (i) in the calculation. If
None
all the isotopes inabu
with the same element symbol and suffix asnormrat
will be selected. -
normrat
–The keys (kj) used for internal normalisation.
-
stdmass
–A keyarray containing the isotope masses.
-
stdabu
–A keyarray containing the reference abundances.
-
enrichment_factor
–Enrichment factor applied to
abu
. Useful when doing multiple elements at once. -
relative_enrichment
–If ''True'' the abundances of all
isotopes
inabu
are multiplied byenrichment_factor
. IfFalse
the abundances are first renormalised such that their sum = 1 and then multiplied byenrichment_factor
. -
std_enrichment_factor
–Enrichment factor applied to
stdabu
. Useful when doing multiple elements at once. -
std_relative_enrichment
–If ''True'' the abundances of all
isotopes
instdabu
are multiplied bystd_enrichment_factor
. IfFalse
the abundances are first renormalised such that their sum = 1 and then multiplied bystd_enrichment_factor
. -
method
(string
, default:'largest_offset'
) –The method used. See options in section below.
-
**method_kwargs
–Additional arguments for the chosen
method
.
Notes
The normrat
numerator and denominator isotopes will be appended to isotopes
if not initially included.
This is done before the enrichment factor calculation.
The enrichment factor should only be used in conjunction with the largest_offset
method. It might not work as
expected for other methods.
Methods
-
largest_offset
This is the default method which internally normalises a synthetic sample such that the largest offset, in epsilon units, is equal to a specified value, by default 1. For more details and a list of additional arguments see intnorm_largest_offset. -
linear
Internally normalise the abundances using the linearised internal normalisation procedure. For more details anda list of additional arguments see intnorm_linear.
Returns:
-
dict
–A dictionary containing the results of the normalisation. The dictionary at minimum contains the following attrs:
eRi
: A key array containing the eRi values for each column ineRi_keys
.eRi_keys
: The numerator isotopes for each column ineRi_values
.ij_key
,kj_key
: Dictionaries mappingeRi_keys
to the numerator-denominator keys (ij) and the normalising keys (kj) for each column ineRi
.label_args
,label_latex
: Dictionaries mappingeRi_keys
to plain text and latex labels suitable for plotting. Contains the ε symbol followed by the numerator isotope and the last digit of each mass in the normalising keys, in brackets. E.g. ε104Pd(85) and \(\epsilon{}^{105}\mathrm{Pd}_{(85)}\), where i=Pd-104, k=Pd-108 and j=Pd-105.- Additional attrs might be supplied by the different methods.
Source code in simple/norm.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
|
simple.norm.intnorm_largest_offset
intnorm_largest_offset(abu_i, abu_j, abu_k, mass_i, mass_j, mass_k, std_i, std_j, std_k, largest_offset=1, min_dilution_factor=0.1, max_iterations=100, largest_offset_rtol=0.0001, *, msg_prefix='')
Creates and internally normalises a synthetic sample such that the largest offset is equal to the specified value.
The composition of the synthetic sample (\(\mathrm{SMP}\)) is calculated by adding \(\mathrm{ABU}\), divided by the dilution factor (\(\mathrm{df}\)), to \(\mathrm{STD}\),
The internal normalisation procedure uses Equation 6 from Lugaro et al. 2023,
Where, \(Q\) is the difference in the natural logarithm of the masses,
Parameters:
-
abu_i
–Abundance of the numerator isotopes.
-
abu_j
–Abundance of the denominator isotopes
-
abu_k
–Abundance of the normalising isotopes.
-
mass_i
–The mass of each isotope in
abu_i
. -
mass_j
–The mass of each isotope in
abu_j
. -
mass_k
–The mass of each isotope in
abu_k
. -
std_i
–The reference abundance of each isotope in
abu_i
. -
std_j
–The reference abundance of each isotope in
abu_j
. -
std_k
–The reference abundance of each isotope in
abu_k
. -
largest_offset
–The absolute value of the largest offset for each row finished calculation, in epsilon units.
-
min_dilution_factor
–The smallest dilution factor considered in the calculation. If the offset found at this dilution factor is smaller than
largest_offset
the result is set tonp.nan
. -
max_iterations
–Any row for which the results have not converged after this number of iterations is set to
np.nan
-
largest_offset_rtol
–The relative tolerance used to test for convergence of the largest offset value.
Returns:
-
dict
–A dictionary containing the results of the normalisation. The dictionary contains the following attrs:
eRi_values
: An 2dim values containing the eRi values for each isotope.dilution_factor
: The dilution factor for each row ineRi_values
.largest_offset
: Thelargest_offset
parameter.min_dilution_factor
: Themin_dilution_factor
parameter.method
: The method used to normalise the abundances. Always"largest_offset"
for this method.
Source code in simple/norm.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
simple.norm.intnorm_linear
intnorm_linear(abu_i, abu_j, abu_k, mass_i, mass_j, mass_k, std_i, std_j, std_k, mass_coef='better', dilution_factor=None, *, msg_prefix='')
Internally normalise the abundances using the linearised internal normalisation procedure.
The internal normalisation procedure uses Equation 7 from Lugaro et al. 2023,
Where, \(Q\) is the difference of the masses calculated in one of two ways. If mass_coeff="better"
the
definition from e.g. Lugaro et al. (2023) is used,
if mass_coeff="simplified"
the definition from e.g. Dauphas et al. (2004) is used,
Parameters:
-
abu_i
–Abundance of the numerator isotopes.
-
abu_j
–Abundance of the denominator isotopes
-
abu_k
–Abundance of the normalising isotopes.
-
mass_i
–The mass of each isotope in
abu_i
. -
mass_j
–The mass of each isotope in
abu_j
. -
mass_k
–The mass of each isotope in
abu_k
. -
std_i
–The reference abundance of each isotope in
abu_i
. -
std_j
–The reference abundance of each isotope in
abu_j
. -
std_k
–The reference abundance of each isotope in
abu_k
. -
mass_coef
(string
, default:'better'
) –Decides how the mass coefficient Q is calculated. Acceptable values are
Notes The epsilon values returned by this method will typically be very large as no dilution takes places.
Enrichment factors will have no impact on the results from this method.
Returns:
-
dict
–A dictionary containing the results of the normalisation. The dictionary contains the following attrs:
eRi_values
: An 2dim values containing the eRi values for each isotope.mass_coef
: The value of themass_coef
parameter.method
: The method used to normalise the abundances. Always"linear"
for this method.
Source code in simple/norm.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
simple.norm.intnorm_precision
intnorm_precision(abu_up, abu_down, abu_norm, mass_up, mass_down, mass_norm, solar_up, solar_down, solar_norm, dilution_step=0.1, precision=0.01, *, msg_prefix='')
Source code in simple/norm.py
215 216 217 218 219 |
|
simple.norm.standard_normalisation
standard_normalisation(abu, isotopes, normiso, stdabu, enrichment_factor=1, relative_enrichment=True, std_enrichment_factor=1, std_relative_enrichment=True, dilution_factor=0, *, msg_prefix='')
Normalise the abundances of abu
relative to a specified isotope normiso
as commonly done for
stardust data.
The equation used to normalise the data is,
Multiple normalisations can be done at once by supplying a list of normalising isotopes. If doing multiple
elements at once then isotopes
, if not None
, and optionally enrichment_factor
and
std_enrichement_factor
, must be lists with the same
length as normiso
. If enrichment_factor
/std_enrichment_factor
is a single value it is applied to
all elements.
Parameters:
-
abu
–A keyarray containing the abundances to be normalised.
-
isotopes
–The numerator isotopes (i) in the calculation. If
None
all the isotopes inabu
with the same element symbol and suffix asnormiso
will be selected. -
normiso
–The denominator isotope for the normalisation.
-
stdmass
–A keyarray containing the isotope masses.
-
stdabu
–A keyarray containing the reference abundances.
-
enrichment_factor
–Enrichment factor applied to
abu
. Useful when doing multiple elements at once. -
relative_enrichment
–If ''True'' the abundances of all
isotopes
inabu
are multiplied byenrichment_factor
. IfFalse
the abundances are first renormalised such that their sum = 1 and then multiplied byenrichment_factor
. -
std_enrichment_factor
–Enrichment factor applied to
stdabu
. Useful when doing multiple elements at once. -
std_relative_enrichment
–If ''True'' the abundances of all
isotopes
instdabu
are multiplied bystd_enrichment_factor
. IfFalse
the abundances are first renormalised such that their sum = 1 and then multiplied bystd_enrichment_factor
.
Notes
The normiso
will be appended to isotopes
if not initially included. This is done before the enrichment
factor calculation.
Returns:
-
dict
–A dictionary containing the results of the normalisation. The dictionary at minimum contains the following attrs:
Ri
: A key array containing the eRi values for each column inRi_keys
.Ri_keys
: The numerator isotopes for each column inRi_values
.ij_keys
: Dictionaries mappingRi_keys
to the numerator-denominator keys (ij) for each column inRi
.Ri_keylabels
,Ri_keylabels_latex
: Dictionaries mappingRi_keys
to plain text and latex labels suitable for plotting. Consists of the ij mass keys followed by the element symbol of the numerator. E.g. 104/105Pd and \({}^{104/105}\mathrm{Pd}\), where i=Pd-104 and j=Pd-105.
Source code in simple/norm.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
|