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σ = [np.float64(1611.0), np.float64(2330.0)] 
 2σ = [np.float64(1355.0), np.float64(2710.0)] 
 Median = 3171.0 
 1σ = [np.float64(2854.0), np.float64(3453.0)] 
 2σ = [np.float64(2494.0), np.float64(3834.0)] 

 Median = 5155.0 
 1σ = [np.float64(5052.0), np.float64(5287.0)] 
 2σ = [np.float64(4976.0), np.float64(5312.0)] 

 Median = 7395.0 
 1σ = [np.float64(7324.0), np.float64(7474.0)] 
 2σ = [np.float64(7273.0), np.float64(7562.0)]