Class: Radiocarbon::C14Date
- Inherits:
-
Object
- Object
- Radiocarbon::C14Date
- Defined in:
- lib/radiocarbon/c14_date.rb
Overview
Represents an uncalibrated radiocarbon date.
Instance Attribute Summary collapse
-
#age ⇒ Object
Conventional radiocarbon age (CRA).
-
#error ⇒ Object
Measurement error.
Instance Method Summary collapse
-
#calibrate(curve = "IntCal20") ⇒ CalDate
Calibrates a radiocarbon date.
-
#dnorm(x, add_error = 0) ⇒ Double
Normal probability density function.
-
#initialize(age, error) ⇒ C14Date
constructor
A new instance of C14Date.
Constructor Details
#initialize(age, error) ⇒ C14Date
Returns a new instance of C14Date.
11 12 13 14 |
# File 'lib/radiocarbon/c14_date.rb', line 11 def initialize(age, error) @age = age @error = error end |
Instance Attribute Details
#age ⇒ Object
Conventional radiocarbon age (CRA)
6 7 8 |
# File 'lib/radiocarbon/c14_date.rb', line 6 def age @age end |
#error ⇒ Object
Measurement error
9 10 11 |
# File 'lib/radiocarbon/c14_date.rb', line 9 def error @error end |
Instance Method Details
#calibrate(curve = "IntCal20") ⇒ CalDate
Calibrates a radiocarbon date
33 34 35 |
# File 'lib/radiocarbon/c14_date.rb', line 33 def calibrate(curve = "IntCal20") Radiocarbon::CalDate.new(self, curve) end |
#dnorm(x, add_error = 0) ⇒ Double
Normal probability density function
22 23 24 25 |
# File 'lib/radiocarbon/c14_date.rb', line 22 def dnorm(x, add_error = 0) sd = Math.sqrt(error**2 + add_error**2) (1 / (sd * Math.sqrt(2 * Math::PI))) * Math.exp(-0.5 * ((x - age) / sd)**2) end |