Giter Club home page Giter Club logo

Comments (7)

Danapit avatar Danapit commented on September 23, 2024 1

Hi! No worries, and you are right, the other issue is a kind of "deeper" question and it's not at all urgent, I no longer work in this field of science and I'm just generally interested, because I find this R package a really cool tool. Plus non-linear fitting is certainly less convenient. There must be a good reason why most of the dating people use the linearized version of fitting.
3. Yes, thank you, plot_Cs_line works for me, great!
Thank you!

from serac.

rosalieb avatar rosalieb commented on September 23, 2024

Hi Dana,

Thank you for your message.
In the original function, we wanted to visualise the line to help the user identify the Cesium peak, even when Cesium would have not been measured at every interval (which could make sense if someone is trying to limit the cost of the analyses).
We had implement the option that any line between two non-consecutive points of measurements would have a smaller width (lwd = 0.5 instead of default of lwd = 1), but I realise it may be too subtle. Therefore, I added on top of that a different line type (dotted line) to make it more obvious that values are missing and that it is an interpolation between 2 points.
That would answer the question if you have NAs in your dataset.

I also added 3 more arguments regarding the detection limit. DL_Pb, DL_Cs and DL_Am, respectively for the detection limits of Pbex, Cs and Am. Any values below these DL for Cs and Am be changed as NA in the first part of the code. For Pb, the values below the detection limit are added to the "ignore" vector (they will be plotted in grey).
I cannot do better than that at the moment - it would require a bit of work to implement a more flexible solution!

Finally, I also added a new argument in the function to prevent from plotting the Cs line to answer the second part of your comment.
Detach the package and reinstall it to be able to use the new argument: plot_Cs_line. The default is TRUE, but if you turn it to FALSE, you will not get the line.

# Re-install serac
detach("package:serac", unload = TRUE)
devtools::install_github("rosalieb/serac", build_vignettes = TRUE)
library(serac)

# Run your code using the argument plot_Cs_lines
serac(..., plot_Cs_line = FALSE, DL_Cs = 20)

To summarise:

  1. I made more obvious what was already implemented for NAs in the Cesium visualisation.
  2. I added 3 arguments to enter detection limits - default for these arguments are NULL.
  3. I added a logical argument to plot or not the Cesium line altogether.

from serac.

Danapit avatar Danapit commented on September 23, 2024

Thanks a lot for the rapid answer! Will test this :)

from serac.

rosalieb avatar rosalieb commented on September 23, 2024

I actually did a few tests with the Am and Cs values totally removed, and it was misleading.. So I changed the code again.
Now, in the same way than it did for Pb, if a value of Cs is < DL_Cs, and a value of Am is < DL_Am, it will be shown on the graph, but in light grey.

The values are still accounted for in the Cesium inventory though...

Here is the result for the test data, with different detection limits (see home page of the package to get the data):

model_ALO09P12 <-
  serac(name="serac_example_ALO09P12", coring_yr=2009, model=c("CFCS"),
        plotphoto=FALSE, minphoto=c(0), maxphoto=c(210),
        plot_Pb=T, plot_Am=T, plot_Cs=T, Cher=c(30,40), Hemisphere=c("NH"), NWT=c(51,61),
        sedchange=c(75.5),
        plot_Pb_inst_deposit=T, inst_deposit=c(20,28,100,107,135,142,158,186),
        suppdescriptor=TRUE, descriptor_lab=c("Ca/Fe"),
        historic_d=c(20,28,100,107,135,142,158,186),
        historic_a=c(1994,1920,1886,1868),
        historic_n=c("sept 1994 flood","1920 flood","1886 flood","1868 flood ?"), 
        min_yr=c(1750),
        dmax=c(180), 
        plotpdf=T, preview=T,
        save_code=FALSE,
        DL_Pb = 25, DL_Cs = 25, DL_Am = 3)

ALO09P12 with random detection limits for test

from serac.

Danapit avatar Danapit commented on September 23, 2024

Hey :) Sorry it took me a while to test this.

  1. I find the solution with the dotted line (to show they are some values missing) really good, thank you.
  2. If I understand correctly, DL is a single value for the entire profile? IMO an additional column in the data table would be better, because they can vary depending on each individual sample / spectrum, depending on parameters like sample mass, measurement time or presence of other radionuclides, which then in gamma spectrum contribute to the Compton background in lower energies, which would effect detectability of 241Am, for example, etc. Below I'm showing one figure from my thesis which illustrates, what I have in mind, in the lower row of figures the decision threshold is plotted for the individual samples.
    image
  3. I tested the serac plot_Cs_lines = FALSE attribute (after reinstalling the package). With this code. serac(name="BY",coring_yr=2007, mass_depth = TRUE, plot_Cs=T, plot_Cs_lines = FALSE, DL_Cs = 1, Hemisphere = "NH", NWT = c(75), sedchange = 80) I got an error Error in serac(name = "BY", coring_yr = 2007, mass_depth = TRUE, plot_Cs = T, : unused argument (plot_Cs_lines = FALSE) and as you can see below (I know, not a pretty profile), the line for 137Cs is still there. Any idea what went wrong?

Rplot_2023-03-15T1526

Thanks!

from serac.

rosalieb avatar rosalieb commented on September 23, 2024

Hi!

Thanks for taking the time to test this. No worries at all about the delay: I still have had no time to check your other issue, and I may have to have you wait for a while, as I have lots of work these days. If you need an answer quicker, feel free to reach out about that other question to my co-author, Pierre Sabatier, as this is more of a "philosophical" question about what to do and not do, and he is the expert on age-depth models (I was the user of chronologies/developer).

To answer your questions:

  1. Great, I am glad this worked for you! Thanks for suggesting the improvement - we had implemented the thinner line, but it was not very visible - dotted solution is better.
  2. I understand what you mean. You are correct, the way it is implemented right now is that the code will only take one "DL_..." per element. The solution of adding a column would be totally doable, and so would be plotting the line as you did in your thesis (I like this idea!). I can try to work on that at a later time, when I have a bit more time - I think this would be great addition.
  3. It is because the argument is plot_Cs_line (no 's'). My bad, I did a typo up there in my previous answer. Re-run the same code with the typo corrected, and you should get what you want.

Let me know if this worked for you, and thank you again for helping improve serac.
PS: I am adding a little check-list for myself:

  • implement the varying detection limit with a new column in the dataset. Add an argument to visualise the DL (see Figure 11 above).
  • check out other issue.

from serac.

rosalieb avatar rosalieb commented on September 23, 2024

Thank you so much for you positive feedback!
I'll come back to work on this when I can.

from serac.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.