R.Luminescence

Board for users of the R.Luminescence package

Reading and select part of BIN file

All kind of issues which do not match to the other forums should be discussed here

Moderator: skreutzer

Reading and select part of BIN file

Postby amini2017 » Mon Mar 06, 2017 7:52 am

Dear R.Lum team,
Good morning,

I am a beginner in using R-luminescence package and there are lots of questions on using it. I have questions on reading .BIN file;
1. I wonder to know what the exact format of the BIN files is. It seems that is as an excel file. How could I have all of the file information in a text file?
2. Why it is necessary to converting Riso.BINfile to Rlum.Analysis for analyses? What are the changes of these two files?
3. When there are some records for example with the same recordType. How could we consider one of them? I mean that after reading a file, and select recordType= OSL; I would like to work on one of these information. For example from the below list, I would like to select and work on the ones with x.max= 59. How could I separate them?

id recordType curveType protocol.step n.channels x.min x.max y.min y.max
1 1 OSL <NA> NA 249 0 59 39 667
2 2 OSL <NA> NA 249 0 59 34 244
3 3 OSL <NA> NA 249 0 90 836 1064
4 4 OSL <NA> NA 249 0 59 38 172
5 5 OSL <NA> NA 249 0 59 35 246
6 6 OSL <NA> NA 249 0 90 896 1176
7 7 OSL <NA> NA 249 0 59 36 445
8 8 OSL <NA> NA 249 0 59 39 229
9 9 OSL <NA> NA 249 0 90 904 1232
10 10 OSL <NA> NA 249 0 59 42 695
11 11 OSL <NA> NA 249 0 59 40 270
12 12 OSL <NA> NA 249 0 90 976 1268

I am using
temp_sel <- get_RLum(object, recordType = c("OSL", x.max= 59), drop = FALSE)
and then
S<- structure_RLum(temp_sel[[1]])[,1:9]

But the S information is the same as later, it seems I should also use another things. What is your idea about it?

I am looking for your advice on them
Best Regards
H. Amini
amini2017
 
Posts: 7
Joined: Sun Feb 26, 2017 3:43 pm

Re: Reading and select part of BIN file

Postby cburow » Thu Mar 09, 2017 12:09 pm

Hi,

first of all, thank you for using the R package 'Luminescence' and your message. I'll try to answer your questions as best as possible:

amini2017 wrote:1. I wonder to know what the exact format of the BIN files is. It seems that is as an excel file. How could I have all of the file information in a text file?


A BIN file is a file format produced by the Risoe TL/OSL reader (link). It is a binary file format and not a text file. If you want to learn more about the file format please see the last section in the official documentation in the Risoe Sequence Editor Manual. If you produce your luminescence data with a reader other than a Risoe reader, however, there is no need for you to concern yourself with the Risoe BIN file format. We also support files produced by Lexsyg and Daybreak TL/OSL readers. You can import any of the BIN, XSYG or Daybreak files with the corresponding R functions read_BIN2R(), read_XSYG2R() and read_Daybreak2R().

amini2017 wrote:2. Why it is necessary to converting Riso.BINfile to Rlum.Analysis for analyses? What are the changes of these two files?


Neither of them are files, but R class objects we introduce in our package. When you import a Risoe BIN file with read_BIN2R() the binary data is converted to human readable text and saved in a Risoe.BINfileData object. A Risoe.BINfileData is the R representation of this particular file format only. But as mentioned above, there are several other manufactures of TL/OSL readers, each with their own file types and structures. This is where the RLum.Analysis object comes into play, which is a standardized and abstract representation of the luminescence data. This is required for our analyses function to work properly, as they assume a common data structure and which is also why you need to convert a Risoe.BINfileData object to a RLum.Analysis first.

amini2017 wrote:3. When there are some records for example with the same recordType. How could we consider one of them? I mean that after reading a file, and select recordType= OSL; I would like to work on one of these information. For example from the below list, I would like to select and work on the ones with x.max= 59. How could I separate them?


Unfortunately, I don't quite understand how you ended up with the table you provided. What kind of file did you import to R? Do you work with Risoe BIN files, or how are your raw luminescence data structured? If you do work with BIN files, have you had a look at our introductory manual on how to use BIN files in our package (link)?
User avatar
cburow
 
Posts: 42
Joined: Thu May 16, 2013 1:39 pm
Location: Cologne

Re: Reading and select part of BIN file

Postby skreutzer » Thu Mar 09, 2017 3:35 pm

Just two comments from my side:

  • The table reported above is produced by the function structure_RLum() and has not that much to do with the BIN-file itself.
  • I highly recommend using the RLum-objects instead of the RisoeBINfileData-objects.

Best,

Sebbastian
skreutzer
 
Posts: 69
Joined: Tue May 14, 2013 4:19 pm

Re: Reading and select part of BIN file

Postby amini2017 » Sun Mar 12, 2017 3:24 pm

Dear All
Thanks for your messages.
I would like to analyze quartz or feldspar aliquots to estimate for example their De.
For a .BIN file of Riso,
I could do this with these functions;

> R0<- read_BIN2R("FAN.BIN")

[read_BIN2R()]
>> FAN.BIN
|=================================================================================================| 100%
>> 116 records have been read successfully!

> pdf(file="F:/H.Amini/5.Luminesence/R-Luminesence/My_test/OSL/1.Analyse_SAR.OSLdata.pdf", paper="a4", height=11)
> output_SAROSLdata=Analyse_SAR.OSLdata(input.data=R0,
+ signal.integral=c(1:5),
+ background.integral=c(80:100),
+ output.plot = TRUE)

[Analyse_SAR.OSLdata()] >> Figure for position 34 produced.
[Analyse_SAR.OSLdata()] >> Position 35 is not valid and has been omitted!

[Analyse_SAR.OSLdata()] >> Figure for position 36 produced.
[Analyse_SAR.OSLdata()] >> Position 37 is not valid and has been omitted!

[Analyse_SAR.OSLdata()] >> Figure for position 38 produced.
[Analyse_SAR.OSLdata()] >> Position 39 is not valid and has been omitted!

[Analyse_SAR.OSLdata()] >> Figure for position 40 produced.

Warning messages:
1: In cbind(RecyclingRatio, Recuperation, IRSL_BOSL) :
number of rows of result is not a multiple of vector length (arg 2)
2: In cbind(RecyclingRatio, Recuperation, IRSL_BOSL) :
number of rows of result is not a multiple of vector length (arg 2)
3: In cbind(RecyclingRatio, Recuperation, IRSL_BOSL) :
number of rows of result is not a multiple of vector length (arg 2)
4: In cbind(RecyclingRatio, Recuperation, IRSL_BOSL) :
number of rows of result is not a multiple of vector length (arg 2)
> dev.off()
null device
1
> Selected_Aliquot=34
> data.LxTx= as.data.frame(cbind(output_SAROSLdata[[1]][[Selected_Aliquot]][c(2,12,13,6)]))
> pdf(file="F:/H.Amini/5.Luminesence/R-Luminesence/My_test/OSL/2.Plot_GrowthCurve.pdf", paper="a4", height=11)
> Growth_curve=plot_GrowthCurve(sample=data.LxTx, fit.method = "LIN", fit.weights = TRUE,fit.includingRepeatedRegPointsNumberIterations.MC=1000, xlab="s",output.plot = TRUE,output.plotExtended = TRUE, cex.global = 1)
[plot_GrowthCurve()] Fit: LIN (regenerative) | De = 1003.15
> dev.off()
null device
1

Are they true and the value reliable?
However, what I asked in last post is depends on using a .BIN file of Lexsgy. The simplest functions were used, and there are several errors;

> R0<- read_BIN2R("Qz De.bin")

[read_BIN2R()]
>> Qz De.bin
|===========================================================================| 100%
>> 840 records have been read successfully!

> object<- Risoe.BINfileData2RLum.Analysis(R0)
> pdf(file="F:/1.Analyse_SAR.OSLdata.pdf", paper="a4", height=11)
> output_SAROSLdata<- analyse_SAR.CWOSL (object = object,
+ signal.integral.min= 1,
+ signal.integral.max= 5,
+ background.integral.min= 50,
+ background.integral.max= 100
+ )
There were 25 warnings (use warnings() to see them)
> warnings()
Warning messages:
1:
[analyse_SAR.CWOSL()] Input OSL/IRSL curves are not a multiple of two.
... >> nothing was done here!
2:
[analyse_SAR.CWOSL()] Input OSL/IRSL curves are not a multiple of two.
... >> nothing was done here!
.
.
.
24:
[analyse_SAR.CWOSL()] Input OSL/IRSL curves are not a multiple of two.
... >> nothing was done here!
25: In merge_RLum(temp) :
[merge_RLum()] Nothing was merged as the object list was found to be empty!

Also the presented information was based on using structure_Rlum of it, after converting it to Rlum.Analysis in R;

> object<- Risoe.BINfileData2RLum.Analysis(R0)
> temp_sel <- get_RLum(object, recordType = c("OSL"), drop = FALSE)
> S<- structure_RLum(temp_sel[[1]])[,1:9]
> S
id recordType curveType protocol.step n.channels x.min x.max y.min y.max
1 1 OSL <NA> NA 249 0 59 39 667
2 2 OSL <NA> NA 249 0 59 34 244
3 3 OSL <NA> NA 249 0 90 836 1064
4 4 OSL <NA> NA 249 0 59 38 172
5 5 OSL <NA> NA 249 0 59 35 246
6 6 OSL <NA> NA 249 0 90 896 1176
7 7 OSL <NA> NA 249 0 59 36 445
8 8 OSL <NA> NA 249 0 59 39 229
9 9 OSL <NA> NA 249 0 90 904 1232
10 10 OSL <NA> NA 249 0 59 42 695
11 11 OSL <NA> NA 249 0 59 40 270
12 12 OSL <NA> NA 249 0 90 976 1268
13 13 OSL <NA> NA 249 0 59 42 900
14 14 OSL <NA> NA 249 0 59 44 252
15 15 OSL <NA> NA 249 0 90 995 1297
16 16 OSL <NA> NA 249 0 59 36 80
17 17 OSL <NA> NA 249 0 59 43 250
18 18 OSL <NA> NA 249 0 90 1008 1344
19 19 OSL <NA> NA 249 0 59 42 208
20 20 OSL <NA> NA 249 0 59 46 244
21 21 OSL <NA> NA 249 0 90 1072 1424

But from them, I would like to use only OSL with Temperature 125. It seems with saving the rows with value 59 in column x.max, it could be done. I wonder to know how I can select them or remove the raw with value 90 in column x.max? Is there any other way to do it?
As the files are from lexsgy, the .XSGY file is also used; but I only could open it.

> R0 <- read_XSYG2R("Qz De.xsyg", fastForward = TRUE, txtProgressBar = FALSE)
[read_XSYG2R()]
Importing: Qz De.xsyg
>> 2 sequence(s) loaded successfully.

But I could not do any others. It seems that the function of .XSGY files are less than .BIN files, is not it? Is it possible to do all analysis on .BIN file also for .XSGY files?
I also try to write it to .BIN (write_R2BIN) but I am not successful also on it.
According to the example of OSL SAR analysis of .XSGY files; Is OSL.SARMeasurement the .XSGY file (R0 for our sample)? “$Sequence.Objcent” also could not find.

Regards
H. Amini
amini2017
 
Posts: 7
Joined: Sun Feb 26, 2017 3:43 pm

Re: Reading and select part of BIN file

Postby skreutzer » Sun Mar 12, 2017 5:29 pm

Dear Hamideh,

... to provide a public solution, here the condensed R code to
analyse the data received via e-mail:

Code: Select all
library(Luminescence)

##import and select measured curves only (inlcuding irradiation)
temp <- read_XSYG2R(file = "Qz De.xsyg", fastForward = TRUE, txtProgressBar = FALSE) %>%
  get_RLum(recordType = c("UVVIS", "irradiation"), drop = FALSE)

##get values
dose_points <- subset(structure_RLum(temp_sel[[1]]), recordType == "irradiation (NA)")$x.max

##every 2nd value is the regeneration dose
dose_points <- dose_points[seq(2,length(dose_points), by = 2)]

##add 0 dose a the begining
dose_points <- c(0, dose_points)

##run analysis
results <- analyse_SAR.CWOSL(
  object = temp_sel,
  signal.integral.min = 1,
  signal.integral.max = 5,
  background.integral.min = 150,
  background.integral.max = 249,
  dose_points = dose_points,
  verbose = FALSE
  )

##show results
results$data

##plot results
plot_KDE(results,
         xlab = expression(paste(D[e], " [s]")))


Best,

Sebastian
skreutzer
 
Posts: 69
Joined: Tue May 14, 2013 4:19 pm

Re: Reading and select part of BIN file

Postby amini2017 » Mon Mar 13, 2017 4:48 pm

Dear Dr. Kreutzer

Thank you so much for your message.

Best Regards
H. Amini
amini2017
 
Posts: 7
Joined: Sun Feb 26, 2017 3:43 pm


Return to General issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron