Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LimaGroup
Lima2
Commits
0a48955b
Commit
0a48955b
authored
Feb 04, 2022
by
Alejandro Homs Puron
Browse files
[IO] Add static data to sparse files: bin radius (1d) & masked pixel radius (2d)
parent
88d09350
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/lima/io/h5/writer.hpp
View file @
0a48955b
...
...
@@ -384,6 +384,8 @@ namespace io
saving_params
const
&
params
,
// Saving params
int
nb_bins
,
// Data
point_t
const
&
dim
,
// HDF5
lima
::
frame
radius1d
,
//
lima
::
frame
radius2d_mask
,
//
h5
::
path
entry_name
=
"/entry_0000"
,
// Nexus
h5
::
path
detector_name
=
"Simulator"
,
//
double
exposure_time
=
0.1
,
//
...
...
@@ -483,19 +485,19 @@ namespace io
// Set dimensions
hsize_t
dims
[]
=
{
m_nb_bins
};
dataspace
file_spac
e
(
lengthof
(
dims
),
dims
);
dataspace
mem_space
(
lengthof
(
dims
),
dims
)
;
auto
file_space
=
dataspace
::
create_simpl
e
(
lengthof
(
dims
),
dims
);
auto
mem_space
=
file_space
;
predef_datatype
dtype
=
datatype
(
v
);
// Create dataset
dataset
mask
(
data
,
"radius"
_p
,
dtype
,
file_space
,
H5P_DEFAULT
,
dcpl
,
H5P_DEFAULT
);
auto
radius
=
dataset
::
create
(
data
,
"radius"
_p
,
dtype
,
file_space
,
H5P_DEFAULT
,
dcpl
,
H5P_DEFAULT
);
// Add attributes
mask
.
attrs
.
create
(
"interpretation"
,
"spectrum"
s
);
mask
.
attrs
.
create
(
"long_name"
,
"Bin radius"
s
);
radius
.
attrs
.
create
(
"interpretation"
,
"spectrum"
s
);
radius
.
attrs
.
create
(
"long_name"
,
"Bin radius"
s
);
// Write
mask
H5Dwrite
(
mask
,
dtype
,
mem_space
,
file_space
,
H5P_DEFAULT
,
&
v
(
0
,
0
)
);
// Write
radius
radius
.
write
(
&
v
(
0
,
0
)
,
dtype
,
mem_space
,
file_space
);
}
// Radius2d-Mask
...
...
@@ -515,19 +517,19 @@ namespace io
// Set dimensions
hsize_t
dims
[]
=
{
m_dimensions
.
y
,
m_dimensions
.
x
};
dataspace
file_spac
e
(
lengthof
(
dims
),
dims
);
dataspace
mem_space
(
lengthof
(
dims
),
dims
)
;
auto
file_space
=
dataspace
::
create_simpl
e
(
lengthof
(
dims
),
dims
);
auto
mem_space
=
file_space
;
predef_datatype
dtype
=
datatype
(
v
);
// Create dataset
dataset
mask
(
data
,
"mask"
_p
,
dtype
,
file_space
,
H5P_DEFAULT
,
dcpl
,
H5P_DEFAULT
);
auto
mask
=
dataset
::
create
(
data
,
"mask"
_p
,
dtype
,
file_space
,
H5P_DEFAULT
,
dcpl
,
H5P_DEFAULT
);
// Add attributes
mask
.
attrs
.
create
(
"interpretation"
,
"image"
s
);
mask
.
attrs
.
create
(
"long_name"
,
"Detector masked radius2d"
s
);
// Write mask
H5D
write
(
mask
,
dtype
,
mem_space
,
file_space
,
H5P_DEFAULT
,
&
v
(
0
,
0
)
);
mask
.
write
(
&
v
(
0
,
0
)
,
dtype
,
mem_space
,
file_space
);
}
// Background
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment