Skip to content

Integrate Segway Toolkit into Segway#181

Open
isaiahah wants to merge 96 commits intohoffmangroup:developfrom
isaiahah:gmtk-api
Open

Integrate Segway Toolkit into Segway#181
isaiahah wants to merge 96 commits intohoffmangroup:developfrom
isaiahah:gmtk-api

Conversation

@isaiahah
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Member

@EricR86 EricR86 left a 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?

Comment thread segway/_util.py Outdated
Comment thread segway/gmtk/input_master.py Outdated
Comment thread segway/gmtk/input_master.py Outdated
Comment thread segway/gmtk/input_master.py Outdated
Comment thread segway/gmtk/input_master.py Outdated
Comment thread segway/gmtk/input_master.py Outdated
Comment thread segway/gmtk/input_master.py Outdated
Comment thread segway/input_master.py Outdated
Comment thread segway/input_master.py Outdated
Comment thread segway/run.py Outdated
Copy link
Copy Markdown
Member

@EricR86 EricR86 left a 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.

Comment thread segway/gmtk/input_master.py Outdated
Comment thread segway/input_master.py Outdated
Comment thread segway/input_master.py Outdated
Comment thread segway/input_master.py
Comment thread segway/input_master.py Outdated
Copy link
Copy Markdown
Contributor

@michaelmhoffman michaelmhoffman left a 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
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

Comment thread segway/gmtk/params.py Outdated
"""
# 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
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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.

Comment thread 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.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverse if possible

Copy link
Copy Markdown
Contributor Author

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.

Comment thread 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."
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

Comment thread 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()
Copy link
Copy Markdown
Contributor

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().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed throughout.

Comment thread 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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isinstance(value, (OneLineArray, VirtualEvidence))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

Comment thread segway/gmtk/params.py Outdated
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
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed throughout.

Comment thread 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]
Copy link
Copy Markdown
Contributor

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()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed throughout.

Comment thread segway/input_master.py
@@ -0,0 +1,503 @@
#!/usr/bin/env python

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants