-
Notifications
You must be signed in to change notification settings - Fork 22
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
Modularize and Refactor PolyPhy Python Package #60
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.
@pjflux2001 Thanks for working on these changes. I recommend that all source code should be in src/polyphy/.
That is where we define the abstractions and inherit objects; in that way, we shall have all the common objects in one place and have polyphy2D and polyphy3D break off from the main objects.
Then the experimental Jupyter notebooks can have very few lines of code because they are importing the modules in the src/polyphy. Otherwise, I feel like you have just dumbed down the same code here with no refactoring done.
@@ -0,0 +1,15 @@ | |||
[Window][Debug##Default] |
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.
Make sure you have documentation for this file somewhere in the developer/contributor docs.
@ti.kernel | ||
def deposit_relaxation_step(self,attenuation: TypeAliases.FLOAT_GPU, current_deposit_index: TypeAliases.INT_GPU): | ||
for cell in ti.grouped(self.fieldVariables.deposit_field): | ||
## The "beautiful" expression below implements a 3x3 kernel diffusion with manually wrapped addressing |
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.
Do we need these commented lines?
@ti.kernel | ||
def trace_relaxation_step(self,attenuation: TypeAliases.FLOAT_GPU): | ||
for cell in ti.grouped(self.fieldVariables.trace_field): | ||
## Perturb the attenuation by a small factor to avoid accumulating quantization errors |
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 recommend using single # for comments.
raise AttributeError(f"'StateFlags' has no attribute '{flag_name}'") | ||
|
||
|
||
## Initialize Taichi |
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 looks like hanging code.
ROOT = '../../../' | ||
|
||
## Data input file - leave empty for random set | ||
INPUT_FILE = ROOT + 'data/csv/sample_2D_linW.csv' |
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.
use os.path.join and wrap the INPUT_FILE in os.normpath, this will remove platform dependencies i.e, win("//") vs unix ("/")
class PolyPhyWindow: | ||
def __init__(self, k, simulationVisuals): | ||
## check if file exists | ||
if os.path.exists("/tmp/flag") == False: |
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.
if not os.path.exists("/tmp/flag"):
Kudos, SonarCloud Quality Gate passed! |
No description provided.