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
tomotools
Nabu
Commits
c39ef4a6
Commit
c39ef4a6
authored
May 11, 2021
by
Pierre Paleo
Browse files
nabu CLI: Fix single scalar user indice
parent
877af696
Changes
1
Hide whitespace changes
Inline
Side-by-side
nabu/resources/cli/reconstruct.py
View file @
c39ef4a6
...
...
@@ -5,6 +5,7 @@ from ...io.config import NabuConfigParser, validate_nabu_config
from
.utils
import
parse_params_values
from
..utils
import
is_hdf5_extension
from
.cli_configs
import
ReconstructConfig
from
..validators
import
convert_to_int
def
update_reconstruction_start_end
(
conf_dict
,
user_indices
):
...
...
@@ -12,24 +13,30 @@ def update_reconstruction_start_end(conf_dict, user_indices):
return
rec_cfg
=
conf_dict
[
"reconstruction"
]
err
=
None
if
user_indices
in
[
"first"
,
"middle"
,
"last"
]:
val_int
,
conv_err
=
convert_to_int
(
user_indices
)
if
conv_err
is
None
:
start_z
=
user_indices
end_z
=
user_indices
elif
user_indices
==
"all"
:
start_z
=
0
end_z
=
-
1
elif
"-"
in
user_indices
:
try
:
start_z
,
end_z
=
user_indices
.
split
(
"-"
)
start_z
=
int
(
start_z
)
end_z
=
int
(
end_z
)
except
Exception
as
exc
:
err
=
"Could not interpret slice indices '%s': %s"
%
(
user_indices
,
str
(
exc
))
else
:
err
=
"Could not interpret slice indices: %s"
%
user_indices
if
err
is
not
None
:
print
(
err
)
exit
(
1
)
if
user_indices
in
[
"first"
,
"middle"
,
"last"
]:
start_z
=
user_indices
end_z
=
user_indices
elif
user_indices
==
"all"
:
start_z
=
0
end_z
=
-
1
elif
"-"
in
user_indices
:
try
:
start_z
,
end_z
=
user_indices
.
split
(
"-"
)
start_z
=
int
(
start_z
)
end_z
=
int
(
end_z
)
except
Exception
as
exc
:
err
=
"Could not interpret slice indices '%s': %s"
%
(
user_indices
,
str
(
exc
))
else
:
err
=
"Could not interpret slice indices: %s"
%
user_indices
if
err
is
not
None
:
print
(
err
)
exit
(
1
)
rec_cfg
[
"start_z"
]
=
start_z
rec_cfg
[
"end_z"
]
=
end_z
...
...
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