{
  "format": 1,
  "method": "reference-intensity-ratio-xrd",
  "version": "0.1.0",
  "interface": "phase_fractions(areas, rirs, relative_intensities) returns normalized mass fractions for included phases in input order. spiked_fractions(areas, rirs, relative_intensities, standard_area, standard_relative, standard_fraction, standard_rir=1.0) returns analyte mass fractions of the spiked mixture. Relative intensities and the measured standard mass fraction are fractions, not percentages. Measured signals are net areas or calibrated net heights on a common scale. standard_rir is the spike phase RIR against the common reference used for the analytes.",
  "cases": [
    {
      "name": "unequal RIRs and relative lines in closure",
      "operation": "phase_fractions",
      "args": [
        [
          120,
          45,
          10
        ],
        [
          4,
          1.5,
          0.5
        ],
        [
          0.5,
          1,
          1
        ]
      ],
      "expected": [
        0.5454545454545455,
        0.27272727272727276,
        0.18181818181818182
      ],
      "tol": 1e-12
    },
    {
      "name": "zero peak has zero phase fraction",
      "operation": "phase_fractions",
      "args": [
        [
          0,
          30
        ],
        [
          2,
          3
        ],
        [
          1,
          1
        ]
      ],
      "expected": [
        0.0,
        1.0
      ],
      "tol": 1e-12
    },
    {
      "name": "one included phase exhausts closure",
      "operation": "phase_fractions",
      "args": [
        [
          20
        ],
        [
          2
        ],
        [
          0.5
        ]
      ],
      "expected": [
        1.0
      ],
      "tol": 1e-12
    },
    {
      "name": "non-strongest lines for analyte and spike",
      "operation": "spiked_fractions",
      "args": [
        [
          80,
          18
        ],
        [
          2,
          0.75
        ],
        [
          0.5,
          0.8
        ],
        100,
        0.5,
        0.25
      ],
      "expected": [
        0.1,
        0.0375
      ],
      "tol": 1e-12
    },
    {
      "name": "spike differs from the RIR reference phase",
      "operation": "spiked_fractions",
      "args": [
        [
          80,
          18
        ],
        [
          4,
          1.5
        ],
        [
          0.5,
          0.8
        ],
        100,
        0.5,
        0.25,
        2
      ],
      "expected": [
        0.1,
        0.0375
      ],
      "tol": 1e-12
    },
    {
      "name": "Davis Table 2 spiked fractions",
      "operation": "spiked_fractions",
      "args": [
        [
          4661,
          2298
        ],
        [
          4.35,
          2.98
        ],
        [
          1,
          1
        ],
        631,
        1,
        0.2144
      ],
      "expected": [
        0.3640703134961838,
        0.26201682638615603
      ],
      "tol": 1e-12
    },
    {
      "name": "zero analyte areas return zero fractions",
      "operation": "spiked_fractions",
      "args": [
        [
          0,
          0
        ],
        [
          2,
          3
        ],
        [
          1,
          1
        ],
        100,
        1,
        0.1
      ],
      "expected": [
        0.0,
        0.0
      ],
      "tol": 1e-12
    }
  ]
}
