Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python parser for DT5550W bin file
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NML
Python parser for DT5550W bin file
Commits
eacbaaf5
Commit
eacbaaf5
authored
1 year ago
by
mingf2
Browse files
Options
Downloads
Patches
Plain Diff
save in h5 format
parent
b32a63e4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
example_h5.cpp
+17
-17
17 additions, 17 deletions
example_h5.cpp
with
17 additions
and
17 deletions
example_h5.cpp
+
17
−
17
View file @
eacbaaf5
...
@@ -38,23 +38,24 @@ int main(int argc, char** argv)
...
@@ -38,23 +38,24 @@ int main(int argc, char** argv)
}
}
print_execution_time
();
print_execution_time
();
// save data to txt files
//
//
save data to txt files
std
::
ofstream
outfile_LG
(
"timestamps.txt"
);
//
std::ofstream outfile_LG("timestamps.txt");
if
(
!
outfile_LG
){
// file couldn't be opened
//
if(!outfile_LG){// file couldn't be opened
std
::
cerr
<<
"Error: timestamps.txt could not be opened"
<<
std
::
endl
;
//
std::cerr << "Error: timestamps.txt could not be opened" << std::endl;
exit
(
1
);
//
exit(1);
}
//
}
for
(
int
i
=
0
;
i
<
newEvents
.
size
();
i
++
)
//
for (int i=0; i<newEvents.size();i++)
{
//
{
for
(
int
j
=
0
;
j
<
32
;
j
++
)
//
for (int j=0; j<32; j++)
{
//
{
outfile_LG
<<
newEvents
[
i
].
chargeLG
[
j
]
<<
' '
;
// separated by space
//
outfile_LG << newEvents[i].chargeLG[j] << ' '; // separated by space
}
//
}
outfile_LG
<<
'\n'
;
//
outfile_LG << '\n';
}
//
}
outfile_LG
.
close
();
//
outfile_LG.close();
print_execution_time
();
//
print_execution_time();
// save data to HDF5
std
::
vector
<
std
::
vector
<
uint16_t
>>
LG_charges
(
newEvents
.
size
(),
std
::
vector
<
uint16_t
>
(
32
,
0
));
std
::
vector
<
std
::
vector
<
uint16_t
>>
LG_charges
(
newEvents
.
size
(),
std
::
vector
<
uint16_t
>
(
32
,
0
));
std
::
vector
<
uint64_t
>
timestamps
(
newEvents
.
size
(),
0
);
std
::
vector
<
uint64_t
>
timestamps
(
newEvents
.
size
(),
0
);
for
(
int
i
=
0
;
i
<
newEvents
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
newEvents
.
size
();
i
++
)
...
@@ -65,7 +66,6 @@ int main(int argc, char** argv)
...
@@ -65,7 +66,6 @@ int main(int argc, char** argv)
{
{
timestamps
[
i
]
=
newEvents
[
i
].
RunEventTimecode
;
timestamps
[
i
]
=
newEvents
[
i
].
RunEventTimecode
;
}
}
const
std
::
string
FILE_NAME
(
"newEvents.h5"
);
try
{
try
{
// Create a new file using the default property lists.
// Create a new file using the default property lists.
HighFive
::
File
file
(
"newEvents.h5"
,
HighFive
::
File
::
ReadWrite
|
HighFive
::
File
::
Create
|
HighFive
::
File
::
Overwrite
);
HighFive
::
File
file
(
"newEvents.h5"
,
HighFive
::
File
::
ReadWrite
|
HighFive
::
File
::
Create
|
HighFive
::
File
::
Overwrite
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment