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

Feature clusterer import method #76

Merged
merged 10 commits into from
Jan 13, 2025

Conversation

sbaldu
Copy link
Collaborator

@sbaldu sbaldu commented Jan 13, 2025

This PR adds a method to the Python API for importing the results of a clustering done previously and saved to a csv file using the to_csv method.
NOTE: it also adds the weight columnt to the csv generated with to_csv.

CLUEstering/CLUEstering.py Fixed Show fixed Hide fixed
CLUEstering/CLUEstering.py Fixed Show fixed Hide fixed
CLUEstering/CLUEstering.py Fixed Show fixed Hide fixed
CLUEstering/CLUEstering.py Fixed Show fixed Hide fixed
if __name__ == "__main__":
c = clusterer(0.8, 5, 1.)
c.read_data('./blob.csv')
c = clusterer(20., 10., 20.)

Check warning

Code scanning / Pylint (reported by Codacy)

Constant name "c" doesn't conform to UPPER_CASE naming style Warning

Constant name "c" doesn't conform to UPPER_CASE naming style
CLUEstering/CLUEstering.py Fixed Show fixed Hide fixed
d = clue.clusterer(20., 10., 20.)
d.import_clusterer('./', 'test_sissa_import.csv')

assert c.clust_prop == d.clust_prop

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
tests/test_clusterer_import.py Fixed Show fixed Hide fixed
'''
'''

from check_result import check_result

Check warning

Code scanning / Prospector (reported by Codacy)

Unused check_result imported from check_result (unused-import) Warning test

Unused check_result imported from check_result (unused-import)
from check_result import check_result
import os
import sys
import pandas as pd

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'pandas' (import-error) Warning test

Unable to import 'pandas' (import-error)
import os
import sys
import pandas as pd
import pytest

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'pytest' (import-error) Warning test

Unable to import 'pytest' (import-error)
import pandas as pd
import pytest
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue

Check warning

Code scanning / Prospector (reported by Codacy)

Import "import CLUEstering as clue" should be placed at the top of the module (wrong-import-position) Warning test

Import "import CLUEstering as clue" should be placed at the top of the module (wrong-import-position)

assert c.clust_prop == d.clust_prop

if __name__ == "__main__":

Check warning

Code scanning / Prospector (reported by Codacy)

expected 2 blank lines after class or function definition, found 1 (E305) Warning test

expected 2 blank lines after class or function definition, found 1 (E305)
tests/test_clusterer_import.py Fixed Show fixed Hide fixed
@@ -0,0 +1,47 @@
'''

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Similar lines in 2 files Warning test

Similar lines in 2 files
tests/test_clusterer_import.py Fixed Show fixed Hide fixed
'''
'''

from check_result import check_result

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Unused check_result imported from check_result Note test

Unused check_result imported from check_result
'''

from check_result import check_result
import os

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

standard import "import os" should be placed before "from check_result import check_result" Warning test

standard import "import os" should be placed before "from check_result import check_result"

from check_result import check_result
import os
import sys

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

standard import "import sys" should be placed before "from check_result import check_result" Warning test

standard import "import sys" should be placed before "from check_result import check_result"
if os.path.isfile('./test_sissa_import.csv'):
os.remove('./test_sissa_import.csv')

c = clue.clusterer(20., 10., 20.)

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Redefining name 'c' from outer scope (line 39) Note test

Redefining name 'c' from outer scope (line 39)
if os.path.isfile('./test_sissa_import.csv'):
os.remove('./test_sissa_import.csv')

c = clue.clusterer(20., 10., 20.)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Variable name "c" doesn't conform to snake_case naming style Warning test

Variable name "c" doesn't conform to snake_case naming style
c.run_clue()
c.to_csv('./', 'test_sissa_import.csv')

d = clue.clusterer(20., 10., 20.)

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Redefining name 'd' from outer scope (line 45) Note test

Redefining name 'd' from outer scope (line 45)
c.run_clue()
c.to_csv('./', 'test_sissa_import.csv')

d = clue.clusterer(20., 10., 20.)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Variable name "d" doesn't conform to snake_case naming style Warning test

Variable name "d" doesn't conform to snake_case naming style
tests/test_clusterer_import.py Fixed Show fixed Hide fixed
tests/test_clusterer_import.py Fixed Show fixed Hide fixed
@@ -0,0 +1,47 @@
'''

Check warning

Code scanning / Pylint (reported by Codacy)

Similar lines in 2 files Warning test

Similar lines in 2 files
'''
'''

from check_result import check_result

Check notice

Code scanning / Pylint (reported by Codacy)

Unused check_result imported from check_result Note test

Unused check_result imported from check_result
'''

from check_result import check_result
import os

Check warning

Code scanning / Pylint (reported by Codacy)

standard import "import os" should be placed before "from check_result import check_result" Warning test

standard import "import os" should be placed before "from check_result import check_result"

from check_result import check_result
import os
import sys

Check warning

Code scanning / Pylint (reported by Codacy)

standard import "import sys" should be placed before "from check_result import check_result" Warning test

standard import "import sys" should be placed before "from check_result import check_result"
c.run_clue()
c.to_csv('./', 'test_sissa_import.csv')

d = clue.clusterer(20., 10., 20.)

Check warning

Code scanning / Pylint (reported by Codacy)

Variable name "d" doesn't conform to snake_case naming style Warning test

Variable name "d" doesn't conform to snake_case naming style
c.run_clue()
c.to_csv('./', 'test_sissa_import.csv')

d = clue.clusterer(20., 10., 20.)

Check notice

Code scanning / Pylint (reported by Codacy)

Redefining name 'd' from outer scope (line 45) Note test

Redefining name 'd' from outer scope (line 45)
assert c.clust_prop == d.clust_prop

if __name__ == "__main__":
c = clue.clusterer(20., 10., 20.)

Check warning

Code scanning / Pylint (reported by Codacy)

Variable name "c" doesn't conform to snake_case naming style Warning test

Variable name "c" doesn't conform to snake_case naming style
c.cluster_plotter()
c.to_csv('./', 'test_sissa_import.csv')

d = clue.clusterer(20., 10., 20.)

Check warning

Code scanning / Pylint (reported by Codacy)

Constant name "d" doesn't conform to UPPER_CASE naming style Warning test

Constant name "d" doesn't conform to UPPER_CASE naming style
tests/test_clusterer_import.py Fixed Show fixed Hide fixed
@sbaldu sbaldu merged commit 4d5eee0 into cms-patatrack:main Jan 13, 2025
9 of 12 checks passed
@sbaldu sbaldu deleted the feature-clusterer-import branch January 13, 2025 10:51
sbaldu added a commit to sbaldu/CLUEstering that referenced this pull request Jan 14, 2025
* Add `import_clusterer` method

* Add test for new clusterer import

* Add docstring

* Fix "if main" of test file

* Addition to gitignore
sbaldu added a commit that referenced this pull request Jan 14, 2025
* Rework points as SoA

Update backend code

Update binding modules

Update python API

Add tests for host-side point SoA

Update run_clue for CUDA and HIP

Update benchmarking scripts

Move test folder

Fix device memory access in memcpy

* Feature clusterer import method (#76)

* Add `import_clusterer` method

* Add test for new clusterer import

* Add docstring

* Fix "if main" of test file

* Addition to gitignore

* Small fix in getGlobalBin (#75)

* Small fix in getGlobalBin

* Update version

* Formatting

Fix after merge

* Separate alpaka input and result buffers

Fix partial dimensional clustering

Update package version
@sbaldu sbaldu added this to the Develop C++ interface milestone Jan 14, 2025
sbaldu added a commit to sbaldu/CLUEstering that referenced this pull request Jan 15, 2025
* Add `import_clusterer` method

* Add test for new clusterer import

* Add docstring

* Fix "if main" of test file

* Addition to gitignore
sbaldu added a commit to sbaldu/CLUEstering that referenced this pull request Jan 15, 2025
* Rework points as SoA

Update backend code

Update binding modules

Update python API

Add tests for host-side point SoA

Update run_clue for CUDA and HIP

Update benchmarking scripts

Move test folder

Fix device memory access in memcpy

* Feature clusterer import method (cms-patatrack#76)

* Add `import_clusterer` method

* Add test for new clusterer import

* Add docstring

* Fix "if main" of test file

* Addition to gitignore

* Small fix in getGlobalBin (cms-patatrack#75)

* Small fix in getGlobalBin

* Update version

* Formatting

Fix after merge

* Separate alpaka input and result buffers

Fix partial dimensional clustering

Update package version
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.

1 participant