fixed imports by running as a module
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script is used to run the Shake&Tune Python scripts as a module
|
||||||
|
# from the project root directory using its virtual environment
|
||||||
|
# Usage: ./shaketune.sh <args>
|
||||||
|
|
||||||
source ~/klippain_shaketune-env/bin/activate
|
source ~/klippain_shaketune-env/bin/activate
|
||||||
python ~/klippain_shaketune/src/is_workflow.py "$@"
|
cd ~/klippain_shaketune
|
||||||
|
python -m src.is_workflow "$@"
|
||||||
deactivate
|
deactivate
|
||||||
|
|||||||
0
src/graph_creators/__init.py__
Normal file
0
src/graph_creators/__init.py__
Normal file
@@ -10,7 +10,7 @@ import optparse
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.signal import butter, filtfilt
|
from scipy.signal import butter, filtfilt
|
||||||
|
|
||||||
from helpers.locale_utils import print_with_c_locale
|
from ..helpers.locale_utils import print_with_c_locale
|
||||||
|
|
||||||
NUM_POINTS = 500
|
NUM_POINTS = 500
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ from scipy.interpolate import griddata
|
|||||||
|
|
||||||
matplotlib.use('Agg')
|
matplotlib.use('Agg')
|
||||||
|
|
||||||
from helpers.common_func import (
|
from ..helpers.common_func import (
|
||||||
compute_curve_similarity_factor,
|
compute_curve_similarity_factor,
|
||||||
compute_spectrogram,
|
compute_spectrogram,
|
||||||
detect_peaks,
|
detect_peaks,
|
||||||
parse_log,
|
parse_log,
|
||||||
setup_klipper_import,
|
setup_klipper_import,
|
||||||
)
|
)
|
||||||
from helpers.locale_utils import print_with_c_locale, set_locale
|
from ..helpers.locale_utils import print_with_c_locale, set_locale
|
||||||
|
|
||||||
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # For paired peaks names
|
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # For paired peaks names
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ import numpy as np
|
|||||||
|
|
||||||
matplotlib.use('Agg')
|
matplotlib.use('Agg')
|
||||||
|
|
||||||
from helpers.common_func import (
|
from ..helpers.common_func import (
|
||||||
compute_mechanical_parameters,
|
compute_mechanical_parameters,
|
||||||
compute_spectrogram,
|
compute_spectrogram,
|
||||||
detect_peaks,
|
detect_peaks,
|
||||||
parse_log,
|
parse_log,
|
||||||
setup_klipper_import,
|
setup_klipper_import,
|
||||||
)
|
)
|
||||||
from helpers.locale_utils import print_with_c_locale, set_locale
|
from ..helpers.locale_utils import print_with_c_locale, set_locale
|
||||||
|
|
||||||
PEAKS_DETECTION_THRESHOLD = 0.05
|
PEAKS_DETECTION_THRESHOLD = 0.05
|
||||||
PEAKS_EFFECT_THRESHOLD = 0.12
|
PEAKS_EFFECT_THRESHOLD = 0.12
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ import numpy as np
|
|||||||
|
|
||||||
matplotlib.use('Agg')
|
matplotlib.use('Agg')
|
||||||
|
|
||||||
from helpers.common_func import (
|
from ..helpers.common_func import (
|
||||||
compute_mechanical_parameters,
|
compute_mechanical_parameters,
|
||||||
detect_peaks,
|
detect_peaks,
|
||||||
identify_low_energy_zones,
|
identify_low_energy_zones,
|
||||||
parse_log,
|
parse_log,
|
||||||
setup_klipper_import,
|
setup_klipper_import,
|
||||||
)
|
)
|
||||||
from helpers.locale_utils import print_with_c_locale, set_locale
|
from ..helpers.locale_utils import print_with_c_locale, set_locale
|
||||||
|
|
||||||
PEAKS_DETECTION_THRESHOLD = 0.05
|
PEAKS_DETECTION_THRESHOLD = 0.05
|
||||||
PEAKS_RELATIVE_HEIGHT_THRESHOLD = 0.04
|
PEAKS_RELATIVE_HEIGHT_THRESHOLD = 0.04
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 607 KiB After Width: | Height: | Size: 607 KiB |
0
src/helpers/__init__.py
Normal file
0
src/helpers/__init__.py
Normal file
@@ -6,8 +6,6 @@
|
|||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from is_workflow import Config
|
|
||||||
|
|
||||||
|
|
||||||
def wait_file_ready(filepath: Path) -> None:
|
def wait_file_ready(filepath: Path) -> None:
|
||||||
file_busy = True
|
file_busy = True
|
||||||
@@ -37,7 +35,6 @@ def wait_file_ready(filepath: Path) -> None:
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def ensure_folders_exist() -> None:
|
def ensure_folders_exist(folders: list[Path]) -> None:
|
||||||
for subfolder in Config.RESULTS_SUBFOLDERS.values():
|
for folder in folders:
|
||||||
folder = Config.RESULTS_BASE_FOLDER / subfolder
|
folder.mkdir(parents=True, exist_ok=True)
|
||||||
Path(folder).mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ from typing import Callable, Optional
|
|||||||
from git import GitCommandError, Repo
|
from git import GitCommandError, Repo
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
|
|
||||||
import helpers.filemanager as fm
|
import src.helpers.filemanager as fm
|
||||||
from graph_creators.analyze_axesmap import axesmap_calibration
|
from src.graph_creators.analyze_axesmap import axesmap_calibration
|
||||||
from graph_creators.graph_belts import belts_calibration
|
from src.graph_creators.graph_belts import belts_calibration
|
||||||
from graph_creators.graph_shaper import shaper_calibration
|
from src.graph_creators.graph_shaper import shaper_calibration
|
||||||
from graph_creators.graph_vibrations import vibrations_profile
|
from src.graph_creators.graph_vibrations import vibrations_profile
|
||||||
from helpers.locale_utils import print_with_c_locale
|
from src.helpers.locale_utils import print_with_c_locale
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
@@ -358,7 +358,9 @@ class AxesMapFinder:
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
options = Config.parse_arguments()
|
options = Config.parse_arguments()
|
||||||
fm.ensure_folders_exist()
|
fm.ensure_folders_exist(
|
||||||
|
folders=[Config.RESULTS_BASE_FOLDER / subfolder for subfolder in Config.RESULTS_SUBFOLDERS.values()]
|
||||||
|
)
|
||||||
|
|
||||||
print_with_c_locale(f'Shake&Tune version: {Config.get_git_version()}')
|
print_with_c_locale(f'Shake&Tune version: {Config.get_git_version()}')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user