Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plio
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
aflab
astrogeology
Plio
Commits
e3adfba8
Unverified
Commit
e3adfba8
authored
2 years ago
by
Kirsten Bauck
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Small changes to improve run time (#184)
parent
b73e664e
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
plio/io/io_controlnetwork.py
+8
-5
8 additions, 5 deletions
plio/io/io_controlnetwork.py
with
8 additions
and
5 deletions
plio/io/io_controlnetwork.py
+
8
−
5
View file @
e3adfba8
...
...
@@ -333,14 +333,17 @@ class IsisStore(object):
# Get the point specification from the protobuf
point_spec
=
cnf
.
ControlPointFileEntryV0002
()
# Set refrence row to minimize .iloc calls and improve run time
reference_row
=
g
.
iloc
[
0
]
# Set the ID and then loop over all of the attributes that the
# point has and check for corresponding columns in the group and
# set with the correct type
#point_spec.id = _set_pid(i)
point_spec
.
id
=
_set_pid
(
i
)
point_spec
.
type
=
g
.
iloc
[
0
]
.
pointType
point_spec
.
type
=
reference_row
.
pointType
try
:
point_spec
.
referenceIndex
=
g
.
iloc
[
0
]
.
referenceIndex
point_spec
.
referenceIndex
=
reference_row
.
referenceIndex
except
:
warnings
.
warn
(
f
'
Unable to identify referenceIndex for point
{
point_spec
.
id
}
. Defaulting to index 0.
'
)
point_spec
.
referenceIndex
=
0
...
...
@@ -354,16 +357,16 @@ class IsisStore(object):
continue
# As per protobuf docs for assigning to a repeated field.
if
df_attr
==
'
aprioriCovar
'
or
df_attr
==
'
adjustedCovar
'
:
arr
=
g
.
iloc
[
0
]
[
df_attr
]
arr
=
reference_row
[
df_attr
]
if
isinstance
(
arr
,
np
.
ndarray
):
arr
=
arr
.
ravel
().
tolist
()
if
arr
:
point_spec
.
aprioriCovar
.
extend
(
arr
)
# If field is repeated you must extend instead of assign
elif
cnf
.
_CONTROLPOINTFILEENTRYV0002
.
fields_by_name
[
attr
].
label
==
3
:
getattr
(
point_spec
,
attr
).
extend
(
g
.
iloc
[
0
]
[
df_attr
])
getattr
(
point_spec
,
attr
).
extend
(
reference_row
[
df_attr
])
else
:
setattr
(
point_spec
,
attr
,
attrtype
(
g
.
iloc
[
0
]
[
df_attr
]))
setattr
(
point_spec
,
attr
,
attrtype
(
reference_row
[
df_attr
]))
# A single extend call is cheaper than many add calls to pack points
measure_iterable
=
[]
...
...
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