-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
322 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ pytest | |
# quality control | ||
mypy | ||
pylint | ||
black | ||
|
||
numpy | ||
matplotlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
|
||
import random | ||
from typing import List, Tuple | ||
|
||
|
||
class CellPicker: | ||
""" Sequence of cells in (random) order from (num_rows x num_cols) sized grid""" | ||
|
||
"""Sequence of cells in (random) order from (num_rows x num_cols) sized grid""" | ||
|
||
# ------------------------------- | ||
def __init__(self, num_rows: int, num_cols: int): | ||
""" order of indices: (row_idx, col_idx) -not- (col_idx, row_idx)~(x,y) | ||
same convention as numpy/pandas """ | ||
"""order of indices: (row_idx, col_idx) -not- (col_idx, row_idx)~(x,y) | ||
same convention as numpy/pandas""" | ||
self.num_rows: int = num_rows | ||
self.num_cols: int = num_cols | ||
|
||
# ------------------------------- | ||
def seq_random(self, deterministic=False) -> List[Tuple[int,int]]: | ||
""" return random sequence of cells. | ||
if deterministic is true, then returns the same sequence every time. """ | ||
def seq_random(self, deterministic=False) -> List[Tuple[int, int]]: | ||
"""return random sequence of cells. | ||
if deterministic is true, then returns the same sequence every time.""" | ||
|
||
# Generate a list of all cell indices | ||
indices = [(row, col) for row in range(self.num_rows) for col in range(self.num_cols)] | ||
|
||
if(deterministic): | ||
if deterministic: | ||
random.seed(42) | ||
# Shuffle the indices list in-place to ensure a different order each time | ||
random.shuffle(indices) | ||
|
||
return indices | ||
|
||
|
||
# ------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import os | ||
|
||
|
||
class Config: | ||
# set env var "CI" to disable default plot generation | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.