Skip to content
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

Merged
merged 24 commits into from
Sep 25, 2023
Merged

Modularize and Refactor PolyPhy Python Package #60

merged 24 commits into from
Sep 25, 2023

Conversation

pjflux2001
Copy link
Member

No description provided.

Copy link
Contributor

@PatriceJada PatriceJada left a 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]
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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'
Copy link
Contributor

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:
Copy link
Contributor

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"):

@sonarcloud
Copy link

sonarcloud bot commented Sep 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@OskarElek OskarElek merged commit a443f45 into PolyPhyHub:main Sep 25, 2023
14 checks passed
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