-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Segway Toolkit into Segway #181
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know when you've addressed the changes.
Also can you address the posterior trackfiles in the simplesubseg touchstone folder? Why are they there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! There's only minor comments to address. In general more comments behind the code generating the structure would be very appreciated.
After my comments have been addressed you can ping Michael for a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, will re-review
@@ -1,5 +1,2 @@ | |||
% XXXopt: good candidate for a linear combination C deterministic mapper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please restore this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it might be better to move it to whatever Python code calls this so it isn't copied into every project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved this comment (verbatim) to the Python code which loads this file. See input_master.py
line 121.
segway/data/segway_preamble.tmpl
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just preamble.tmpl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
segway/gmtk/params.py
Outdated
@@ -50,10 +57,11 @@ def __new__(cls, *args: NumericArrayLike, keep_shape: bool = False) \ | |||
(dimension 1) from a single scalar input value. | |||
""" | |||
# Ensure all arguments belong to the correct type | |||
if not all(isinstance(arg, NumericArrayLike) for arg in args): | |||
if not all((isinstance(arg, float) or isinstance(arg, int) or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please replace with at least the tuple (float, int, ndarray)
. That has been supported for a long time, even if union types won't be directly until Py3.10.
I think NumericArrayLike.get_args()
which should get you (float, int, ndarray)
should be even better, because it eliminates future potential inconsistency issues.
Please add a comment indicating the issue with NumericArrayLike
and at what Python version it won't be an issue anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added checking type with the tuple and a comment explaining why. I've used typing.get_args(NumericArrayLike)
to print the types.
segway/gmtk/params.py
Outdated
raise TypeError("Argument has incompatible type. " | ||
f"Expected {NumericArrayLike}") | ||
raise TypeError("Argument has incompatible type." | ||
"Expected float, int, or ndarray.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverse if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reversed the order of these sentences.
segway/gmtk/params.py
Outdated
# If union iterable, fix. Otherwise, hardwrite | ||
raise TypeError("Argument has incompatible type. " | ||
f"Expected {NumericArrayLike}") | ||
raise TypeError("Argument has incompatible type." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a space between sentences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
segway/gmtk/params.py
Outdated
# if stored items are generic strings, return them out without | ||
# any additional formatting. Otherwise, apply formatting | ||
if self.kind == OBJ_KIND_GENERICSTRING: | ||
lines += self.get_unformatted_lines() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use +=
with a list. Switch to lines.extend()
or lines.append()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed throughout.
segway/gmtk/params.py
Outdated
if not isinstance(value, OneLineKind): | ||
# Unless a class where all data is on one line (OneLineArray and | ||
# VirtualEvidence), write the object's remaining lines | ||
if not (isinstance(value, OneLineArray) or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isinstance(value, (OneLineArray, VirtualEvidence))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
segway/gmtk/params.py
Outdated
|
||
|
||
class InlineMCSection(InlineSection): | ||
""" | ||
Special InlineSection subclass which contains MC objects. | ||
Attributes: | ||
mean: the InlineSection object stored at InputMaster.mean | ||
covar: the InlineSection object stored at InputMaster.covar | ||
mean: InlineSection object which point to InputMaster.mean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which point to
-> referred to by
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed throughout.
segway/gmtk/params.py
Outdated
# if line_before is set, use it to begin the section's lines | ||
lines = [] | ||
if self.line_before: | ||
lines += [self.line_before] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as before with .append()
, .extend()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed throughout.
@@ -0,0 +1,503 @@ | |||
#!/usr/bin/env python | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the next round, can you please fix this so that Git knows what it should diff against? It looks like this is modification of old code and I don't think anyone wants us to review it all de novo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was previously segway_input_master.py
. The helper functions and opening section are the only things which were not changed. I haven't yet found a way to change how Git generates the diff, but will at minimum specify the relevant line sections in the next round.
No description provided.