Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
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
Container 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
Tom Rink
python
Commits
fe3b8453
Commit
fe3b8453
authored
10 months ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
14f89207
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
modules/util/hdf5_conversion.py
+10
-0
10 additions, 0 deletions
modules/util/hdf5_conversion.py
with
10 additions
and
0 deletions
modules/util/hdf5_conversion.py
+
10
−
0
View file @
fe3b8453
import
h5py
import
numpy
as
np
import
pandas
as
pd
import
random
def
hdf5_to_npz_csv
(
hdf5_filename
,
output_file_prefix
,
chunk_size
=
10000
):
...
...
@@ -14,6 +15,15 @@ def hdf5_to_npz_csv(hdf5_filename, output_file_prefix, chunk_size=10000):
chunk_size (int): Size of chunks to process at once (default is 1000).
"""
# # New step: keep only 10 mask values == True
# mask_indices = list(np.nonzero(mask)[0])
# if len(mask_indices) > 10:
# selected_indices = random.sample(mask_indices, 10)
# new_mask = np.zeros(mask.size).astype(np.bool)
# new_mask[selected_indices] = True
# mask = new_mask
# keep_array.append(data[mask])
# Step 1: Open HDF5 file
with
h5py
.
File
(
hdf5_filename
,
"
r
"
)
as
file
:
fov_mask
=
np
.
asarray
(
file
[
"
FOV_mask
"
])
...
...
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