Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cfel_fmt
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
dataAnalysis
cfel_fmt
Commits
cd6fab30
Commit
cd6fab30
authored
7 years ago
by
Valerio Mariani
Browse files
Options
Downloads
Patches
Plain Diff
Fixed some code analysis complaints from PyCharm
parent
83314092
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
cfel_cxi.py
+3
-6
3 additions, 6 deletions
cfel_cxi.py
with
3 additions
and
6 deletions
cfel_cxi.py
+
3
−
6
View file @
cd6fab30
...
@@ -31,8 +31,8 @@ import numpy
...
@@ -31,8 +31,8 @@ import numpy
_CXISimpleEntry
=
namedtuple
(
'
SimpleEntry
'
,
[
'
path
'
,
'
data
'
,
'
overwrite
'
])
_CXISimpleEntry
=
namedtuple
(
'
SimpleEntry
'
,
[
'
path
'
,
'
data
'
,
'
overwrite
'
])
def
_assign_data_type
(
data
):
def
_assign_data_type
(
data
):
if
isinstance
(
data
,
numpy
.
ndarray
):
if
isinstance
(
data
,
numpy
.
ndarray
):
data_type
=
data
.
dtype
data_type
=
data
.
dtype
elif
isinstance
(
data
,
bytes
):
elif
isinstance
(
data
,
bytes
):
...
@@ -42,6 +42,7 @@ def _assign_data_type(data):
...
@@ -42,6 +42,7 @@ def _assign_data_type(data):
return
data_type
return
data_type
class
_Stack
:
class
_Stack
:
def
__init__
(
self
,
path
,
data
,
axes
,
compression
,
chunk_size
):
def
__init__
(
self
,
path
,
data
,
axes
,
compression
,
chunk_size
):
...
@@ -72,7 +73,7 @@ class _Stack:
...
@@ -72,7 +73,7 @@ class _Stack:
def
write_initial_slice
(
self
,
file_handle
,
max_num_slices
):
def
write_initial_slice
(
self
,
file_handle
,
max_num_slices
):
file_handle
.
create_dataset
(
self
.
path
,
shape
=
(
max_num_slices
,)
+
self
.
_data_shape
,
file_handle
.
create_dataset
(
self
.
path
,
shape
=
(
max_num_slices
,)
+
self
.
_data_shape
,
dtype
=
self
.
_data_type
,
dtype
=
self
.
_data_type
,
maxshape
=
(
max_num_slices
,)
+
self
.
_data_shape
,
maxshape
=
(
max_num_slices
,)
+
self
.
_data_shape
,
compression
=
self
.
_compression
,
chunks
=
self
.
_chunk_size
)
compression
=
self
.
_compression
,
chunks
=
self
.
_chunk_size
)
...
@@ -123,7 +124,6 @@ class _Stack:
...
@@ -123,7 +124,6 @@ class _Stack:
def
_validate_data
(
data
):
def
_validate_data
(
data
):
if
not
isinstance
(
data
,
(
bytes
,
int
,
float
,
numpy
.
ndarray
)):
if
not
isinstance
(
data
,
(
bytes
,
int
,
float
,
numpy
.
ndarray
)):
raise
RuntimeError
(
'
The CXI Writer only accepts numpy objects, numbers and ascii strings.
'
)
raise
RuntimeError
(
'
The CXI Writer only accepts numpy objects, numbers and ascii strings.
'
)
...
@@ -354,7 +354,6 @@ class CXIWriter:
...
@@ -354,7 +354,6 @@ class CXIWriter:
self
.
_fh
[
path
]
=
link_target
self
.
_fh
[
path
]
=
link_target
def
create_link_to_group
(
self
,
group
,
path
,
overwrite
=
False
):
def
create_link_to_group
(
self
,
group
,
path
,
overwrite
=
False
):
"""
Creates a link to an HDF5 group.
"""
Creates a link to an HDF5 group.
...
@@ -384,7 +383,6 @@ class CXIWriter:
...
@@ -384,7 +383,6 @@ class CXIWriter:
self
.
_fh
[
path
]
=
link_target
self
.
_fh
[
path
]
=
link_target
def
initialize_stacks
(
self
):
def
initialize_stacks
(
self
):
"""
Initializes the stacks.
"""
Initializes the stacks.
...
@@ -521,4 +519,3 @@ class CXIWriter:
...
@@ -521,4 +519,3 @@ class CXIWriter:
self
.
_fh
.
close
()
self
.
_fh
.
close
()
self
.
_file_is_open
=
False
self
.
_file_is_open
=
False
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