Skip to content

Commit

Permalink
store paths in reco files in a relative manner + release
Browse files Browse the repository at this point in the history
  • Loading branch information
tknopp committed Aug 27, 2021
1 parent 27fa4fe commit 475ad51
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MPIFiles"
uuid = "371237a9-e6c1-5201-9adb-3d8cfa78fa9f"
authors = ["Tobias Knopp <tobias@knoppweb.de>"]
version = "0.11.12"
version = "0.11.13"

[deps]
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
Expand Down
37 changes: 33 additions & 4 deletions src/DatasetStore/Reconstruction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ end

function extendPath(d::MDFDatasetStore, p::AbstractString)
if isabspath(p)
return p
return normpath(p)
else
A = joinpath(d.path, p)
if isfile(A)
return A
return normpath(A)
end
B = joinpath(d.path, "..", p)
if isfile(B)
return B
return normpath(B)
end
D = splitpath(p)
if length(D) > 1
Expand All @@ -37,7 +37,7 @@ function extendPath(d::MDFDatasetStore, p::AbstractString)
@info d.path
@info C
if isfile(C)
return C
return normpath(C)
end
end
error("extendPath could not generate valid path. Something is wrong with
Expand All @@ -59,6 +59,33 @@ function normalizePathsRecoDict!(d::MDFDatasetStore, recoParams::Dict)
end
end

function splitOffStorePath(path, foldername)
s = splitpath(path)
i = findfirst(s .== foldername)
if i != nothing
return joinpath(s[i:end]...)
else
return path
end
end

function makeRelativePathsRecoDict!(recoParams::Dict)
coll = Dict((:measPath => "measurements"), (:SFPath => "calibrations"),
(:emptyMeasPath => "measurements"))

for (key,foldername) in coll
if haskey(recoParams, key)
if isa(recoParams[key], AbstractString)
recoParams[key] = splitOffStorePath(recoParams[key],foldername)
elseif isa(recoParams[key], AbstractVector)
for l=1:length(recoParams[key])
recoParams[key][l] = splitOffStorePath(recoParams[key][l],foldername)
end
end
end
end
end

# This functions searches for recoparams and returns the corresponding recoNumber
# 0 indicates that the set of parameters was not found
function findReco(d::MDFDatasetStore, study::Study, exp::Experiment, recoParams::Dict)
Expand Down Expand Up @@ -105,6 +132,8 @@ function addReco(d::MDFDatasetStore, study::Study, exp::Experiment, image)

filepath = joinpath(outputpath, string(recoNum))

image.recoParams = makeRelativePathsRecoDict!(image.recoParams)

saveRecoData(filepath*".mdf", image)
#save(filepath*".jld","recoParams",recoParams)
end
Expand Down

2 comments on commit 475ad51

@tknopp
Copy link
Member Author

@tknopp tknopp commented on 475ad51 Aug 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/43654

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.13 -m "<description of version>" 475ad5178761c502e9745f95c9c33359e9a003d7
git push origin v0.11.13

Please sign in to comment.