Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reading an Opus file #94

Closed
zecojls opened this issue Nov 6, 2023 · 8 comments
Closed

Error reading an Opus file #94

zecojls opened this issue Nov 6, 2023 · 8 comments
Labels
opus-data-support Support new OPUS instrument, block type, OPUS version etc.

Comments

@zecojls
Copy link

zecojls commented Nov 6, 2023

Hi, I'm trying to read an Opus file from a collaborator, and the following error is raised:
"Error in ds_param[[1]] : subscript out of bounds"

Reproducible code:
test <- read_opus_single(dsn = "RT_01_1_23-02-21_13-23-54.0")

The binary Opus file was sent by email to help with debugging. The data comes from a Bruker 2023 Alpha II.

I'm also attaching the screenshots of the file blocks.

Thanks

@zecojls
Copy link
Author

zecojls commented Nov 6, 2023

B00
B01
B02
B03
B04
B05
B06
B07
B08
B09
B10
B11
B12
B13
B14
B15
B16

@philipp-baumann
Copy link
Member

philipp-baumann commented Nov 7, 2023

Hi, I'm trying to read an Opus file from a collaborator, and the following error is raised: "Error in ds_param[[1]] : subscript out of bounds"

Reproducible code: test <- read_opus_single(dsn = "RT_01_1_23-02-21_13-23-54.0")

The binary Opus file was sent by email to help with debugging. The data comes from a Bruker 2023 Alpha II.

I'm also attaching the screenshots of the file blocks.

Thanks

Thanks @zecojls for the screenshots and the issue, @ThomasKnecht and me will investigate and hopefully fix the coming WE. Will keep you up to date. Kind regards, Philipp

@philipp-baumann philipp-baumann added the opus-data-support Support new OPUS instrument, block type, OPUS version etc. label Nov 10, 2023
@philipp-baumann
Copy link
Member

philipp-baumann commented Nov 12, 2023

Hi @zecojls we were able to fix it :-) More infos about v0.6.0 that supports it are here https://github.com/spectral-cockpit/opusreader2/blob/main/NEWS.md

library("opusreader2")
file <- "inst/extdata/new_data/issue94_RT_01_1_23-02-21_13-23-54.0"
data <- read_opus(dsn = file)
names(data[[1]])
#>  [1] "basic_metadata"             "ab_no_atm_comp_data_param" 
#>  [3] "ab_no_atm_comp"             "sc_sample_data_param"      
#>  [5] "sc_sample"                  "sc_ref_data_param"         
#>  [7] "sc_ref"                     "optics"                    
#>  [9] "optics_ref"                 "acquisition_ref"           
#> [11] "fourier_transformation_ref" "fourier_transformation"    
#> [13] "sample"                     "acquisition"               
#> [15] "instrument_ref"             "instrument"                
#> [17] "history"
sessionInfo()
#> R version 4.1.3 (2022-03-10)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.3 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=de_CH.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=de_CH.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=de_CH.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=de_CH.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] opusreader2_0.6.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.33     withr_2.5.0       R.methodsS3_1.8.2 lifecycle_1.0.3  
#>  [5] magrittr_2.0.3    reprex_2.0.2      evaluate_0.22     rlang_1.1.1      
#>  [9] cli_3.6.1         rstudioapi_0.15.0 fs_1.6.3          R.utils_2.12.2   
#> [13] R.oo_1.25.0       vctrs_0.6.3       styler_1.10.2     rmarkdown_2.24   
#> [17] tools_4.1.3       R.cache_0.16.0    glue_1.6.2        purrr_1.0.2      
#> [21] xfun_0.40         yaml_2.3.7        fastmap_1.1.1     compiler_4.1.3   
#> [25] htmltools_0.5.6.1 knitr_1.43

Created on 2023-11-12 with reprex v2.0.2

You can just do an remotes::install_github("spectral-cockpit/opusreader2") to get the newest version.
Once you confirm we can close the issue here.

@zecojls
Copy link
Author

zecojls commented Nov 13, 2023

Great! Thank you guys. Just to confirm with a quick silly question, what is the equivalent R list name to the Opus AB block?

@philipp-baumann
Copy link
Member

ab_no_atm_comp -> see help https://spectral-cockpit.github.io/opusreader2/reference/read_opus.html . Here no CO2/H2O compensation has been done. Our reader can retrieve 2 AB blocks if atmospheric compensation was set in OPUS, meaning we can get both raw apparent abs and the atmospherically correctet apparent abs (propr. OPUS macro). In such a case, although both are present in the file, OPUS software would only show the final compensated spectra in the viewer, which isn't so clever for scalable spectroscopy workflows. Hence the special name ;)

@zecojls
Copy link
Author

zecojls commented Nov 13, 2023

Perfect, thank you. I think in the previous versions the description was not that clear but I'm glad to see you guys improved it a lot. I've been using the reflectance data and transforming it to apparent absorbance with log10(1/R) rather than natural log. Not sure if makes sense to properly document it as log10 for those not familiar with these transformations...

@philipp-baumann
Copy link
Member

Perfect, thank you. I think in the previous versions the description was not that clear but I'm glad to see you guys improved it a lot. I've been using the reflectance data and transforming it to apparent absorbance with log10(1/R) rather than natural log. Not sure if makes sense to properly document it as log10 for those not familiar with these transformations...

ok, great. Fair point, log10 would be good to name explicitly to not confuse with ln.

@philipp-baumann
Copy link
Member

philipp-baumann commented Nov 13, 2023

just fixed to log10(...) 850fa73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
opus-data-support Support new OPUS instrument, block type, OPUS version etc.
Projects
None yet
Development

No branches or pull requests

2 participants