Calculating median and quantiles#

# import core as core
from iosacal import R

This notebook demonstrates how to compute a calibrated median and 68 or 95% confidence interval from a radiocarbon datum.1

#example radiocarbon
c14_ages = [2000, 3000, 4500, 6500]
c14_1σ = [300, 260, 50, 70]

for age, oneσ in zip(c14_ages, c14_1σ):


    cr = R(age, oneσ, 'test')
    cal = cr.calibrate('intcal20')

    quants = cal.quantiles()

    print(f'\n Median = {quants[50]} \n 1σ = {quants[68]} \n 2σ = {quants[95]} ')
 Median = 1969.0 
 1σ = [1611.0, 2330.0] 
 2σ = [1355.0, 2710.0] 
 Median = 3171.0 
 1σ = [2854.0, 3453.0] 
 2σ = [2494.0, 3834.0] 

 Median = 5155.0 
 1σ = [5052.0, 5287.0] 
 2σ = [4976.0, 5312.0] 

 Median = 7395.0 
 1σ = [7324.0, 7474.0] 
 2σ = [7273.0, 7562.0] 

1

This notebook can be downloaded as quantiles_demo.ipynb