ISAAKiel / oxcAAR

R Package - Interaction with Oxcal
GNU General Public License v2.0
21 stars 4 forks source link

Parsing on sigma ranges sometimes fails #27

Closed sbiggles closed 4 years ago

sbiggles commented 4 years ago

The parsing of the sigma ranges from the oxcal output seems to fail occasionally. Using SHCal13 and I think it relates to the possibility of getting multiple values in the range and perhaps one empty e.g., with a ",..." value . It means that occasionally . Oxcal reports the lower values but in the three sigma range in particular fails to set the structure up and report the lower sd value (can handle if the higher one is just NA). I figure it is in the sigma_extract function. E.g., R_Date: BP = 229, std = 35 unmodelled: posterior: one sigma
1659 AD - 1678 AD (14.2%)
1734 AD - 1800 AD (54%)
two sigma
1640 AD - 1710 AD (27.9%)
1720 AD - 1812 AD (61.2%)
1836 AD - 1848 AD (1.3%)
1858 AD - 1880 AD (2.5%)
1928 AD - NA (2.4%)
^^^^ Where the three sigma range ^^^ NA

MartinHinz commented 4 years ago

Thank you so much for reporting! When I tried to reproduce using the current GitHub master branch, I did not get an error and was able to gain a three sigma range, like this:

oxcalCalibrate(229, 35)
OxCal v4.3.2 (c) Bronk Ramsey (2017)

=============================
    R_Date: 1
=============================

BP = 229, std = 35

unmodelled:                    posterior:

one sigma                      
1644 AD - 1676 AD (34.3%)      
1778 AD - 1800 AD (24.5%)      
1942 AD - NA (9.4%)            

two sigma                      
1526 AD - 1556 AD (3.7%)       
1632 AD - 1686 AD (39.6%)      
1732 AD - 1809 AD (39.7%)      
1928 AD - NA (12.4%)           

three sigma                    
1513 AD - 1601 AD (5.4%)       
1616 AD - 1698 AD (40.7%)      
1725 AD - 1816 AD (40.3%)      
1834 AD - 1878 AD (0.5%)       
1916 AD - NA (12.8%)           

Calibrated with:
      IntCal13 atmospheric curve (Reimer et al 2013) 

Could you please specifiy, which version you are using?

sbiggles commented 4 years ago

I think I have it up to date. You are using the IntCal13 not the ShCal13. I think currently the oxcalCalibrate function doesnt let you specify the curve but I generate the OxCal code in R and then calibrate all the dates I am interested in and then parse the results back into R. Oxcal seems to be generating the data so not sure why it could be failing. Thanks, Simon

MartinHinz commented 4 years ago

I was able to reproduce that issue using following script:

library(oxcAAR)
library(magrittr)

quickSetupOxcal()

executeOxcalScript(
  paste('Plot() {
  Curve("SHCal13","shcal13.14c");',
  R_Date("test",229,35),
  "};")
  ) %>% readOxcalOutput() %>% parseOxcalOutput()

It turns out that there is still a general problem, since currently oxcAAR relies on only one cal curve present for all dates, (and by default that this is Intcal13).

Nevertheless, currently the last commit to the master branch should fix that issue raised here for now. Please check and close, if satisfied!

sbiggles commented 4 years ago

Martin- that seems to be working well. Many thanks. Very helpful, Simon