-
Notifications
You must be signed in to change notification settings - Fork 7
Generate random grid #11
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
base: main
Are you sure you want to change the base?
Conversation
creation of the fil "random_grid_generator". The file is still empty.
add generer_grille.
impoving on the strucure of the code with Flake8
Added save_graph
improving the structure of the code
Add docstring
save_graph saves in npz format
The graphs are now saved as .npz (might not work).
delete unecessary
CHrlS98
left a 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.
Première review. Pourras tu aussi ajouter des exemples de résultats dans la description de ta PR pour comprendre ce qu'on est supposé obtenir?
quactography/classical/io.py
Outdated
|
|
||
| np.savez(output_file, nodes=nodes_array, edges=edges_array) | ||
|
|
||
| print(f"Copie {i+1}/{copies} saved as '{output_file}'.") |
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.
En anglais: copy
| import random | ||
| import networkx as nx | ||
|
|
||
| def generer_grille(size, obstacle_mode="ratio", obstacle_ratio=0.2, obstacle_number=20): |
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.
Anglais
scripts/generate_random_grids.py
Outdated
| """ | ||
|
|
||
| import argparse | ||
| from my_research.utils.grid_dijkstra import generer_grille, save_graph |
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 don't see any module named "my_research" in your PR. Are you sure it's the right path?
|
|
||
| obstacles = set() | ||
|
|
||
| if obstacle_mode == "ratio": |
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.
Tu pourrais détecter automatiquement ton mode en fonction de la valeur de obstacle num. Si 0<=num<1 c'est ratio, si num >= 1 c'est le count.
scripts/generate_random_grids.py
Outdated
|
|
||
| if not args.save_only: | ||
| print(f"{number} graphs saved as '{file}_X.npz'.") | ||
| print("Grille générée :") |
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.
Mets en anglais.
| @@ -0,0 +1,15 @@ | |||
| import numpy as np | |||
|
|
|||
| def save_graph(G, output_base, copies=1): | |||
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.
Chaque fonction devrait avoir une documentation qui décrit ce que fait la fonction, les paramètres et les retours
scripts/generate_random_grids.py
Outdated
| help="Size of the grid (grid will be of shape size x size)." | ||
| ) | ||
|
|
||
| parser.add_argument( |
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.
Va voir dans scilpy pour trouver un mutually exclusive arguments.
Tu pourrais mettre un --number OU un --number avec un float pour obstacle et int pour number et c'est argparse qui empêche de mettre les deux à la fois
scripts/generate_random_grids.py
Outdated
| ) | ||
|
|
||
| parser.add_argument( | ||
| '--output', type=str, required=True, |
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.
Le type par défaut c'est str, tu peux retirer le type si c'est str
Add description to save_graph
delete type=str for the output
mutually exclusive
functions path changed
print changes
Standard harshana test
First pull request: add generate_random_grids script.