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.
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}'.") |
| import random | ||
| import networkx as nx | ||
|
|
||
| def generer_grille(size, obstacle_mode="ratio", obstacle_ratio=0.2, obstacle_number=20): |
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.
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.
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 :") |
| @@ -0,0 +1,15 @@ | |||
| import numpy as np | |||
|
|
|||
| def save_graph(G, output_base, copies=1): | |||
There was a problem hiding this comment.
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.
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.
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.