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

Bug in the appendBGDataset function #115

Open
atsanda opened this issue Nov 19, 2024 · 1 comment
Open

Bug in the appendBGDataset function #115

atsanda opened this issue Nov 19, 2024 · 1 comment
Labels

Comments

@atsanda
Copy link

atsanda commented Nov 19, 2024

I encountered with an error while attempting to save a Brucker measurement together with a background measurement as one MDF. I used the saveasMDF with a keyword for the background file. It failed here

paramsBG[:measIsBGFrame][:] = true

paramsBG[:measIsBGFrame][:] is an array and cannot be assigned with a constant true without .=. Moreover, down the code here is cat(4, params[:measData], paramsBG[:measData]) which also should produce an error.

I ended up implementing that by myself. Here is my implementation in case it is useful for a fix.

MPIFile(raw_measurement_path) do raw_measurement_file; MPIFile(bg_measurement_path) do background_file
    params = loadDataset(raw_measurement_file)

    frames=1:acqNumFrames(background_file)
    params_background = loadDataset(background_file, frames=frames)
    params_background[:measIsBGFrame] .= true
    params[:measData] = cat(params[:measData], params_background[:measData], dims=4)
    params[:measIsBGFrame] = cat(params[:measIsBGFrame], params_background[:measIsBGFrame], dims=1)
    params[:acqNumFrames] += params_background[:acqNumFrames]

    h5open(measurement_path, "w") do file
        saveasMDF(file, params)
    end
end;end
@atsanda atsanda added the bug label Nov 19, 2024
@jusack
Copy link
Contributor

jusack commented Nov 23, 2024

Hi, I encountered the same error some time ago, it should be fixed in #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants