Commit 341c423b authored by Michael Rudolf's avatar Michael Rudolf
Browse files

Fixed package visibility problems.

parent 5e4d4236
......@@ -16,14 +16,13 @@ GUI based approach for RSTpicking
import os
import tkinter as tk
import rstevaluation.tools.interface.mainGUI as mainGUI
import rstevaluation.tools.interface.utilities as utils
from . import mainGUI, utilities
def run():
app = mainGUI.RST_pick_GUI(None)
app.title('RSTpick GUI')
image_path = utils.resource_path(
image_path = utilities.resource_path(
os.path.join('images', 'rst-evaluation_x256.ico')
)
try:
......
""" Functions for data handling such as filtering, downsampling and fitting """
import os
import shutil
import nptdms
import numpy as np
import rstevaluation.tools.files as rstfiles
from tqdm import tqdm
def downsample_data(data, R):
......@@ -59,33 +54,3 @@ def downsample_channel(channel, freq):
properties=props
)
return downsampled
def check_tdms(file_list, config):
"""
Checks if a tdms file on the list is longer than allowed. If yes then the
data is automatically downsampled.
"""
max_len = 0
for file_name in tqdm(file_list, desc='Checking TDMS file length'):
cur_len = rstfiles.get_length(
os.path.join(config['paths']['path_in'], file_name)
)
if cur_len > max_len:
max_len = cur_len
if max_len > config.getint('parameters', 'nsamples'):
print(
'Converting folder. Raw data files will be moved to raw_data.'
)
raw_folder = os.path.join(config['paths']['path_in'], 'raw_data')
os.makedirs(
raw_folder,
exist_ok=True
)
for file_name in tqdm(file_list, desc='Downsampling Files'):
file_path = os.path.join(config['paths']['path_in'], file_name)
new_path = os.path.join(raw_folder, file_name)
shutil.move(file_path, new_path)
new_file_path = downsample_file(new_path)
shutil.move(new_file_path, file_path)
......@@ -10,7 +10,9 @@ import os
import nptdms
import numpy as np
import rstevaluation.tools.data as rstdat
from tqdm import tqdm
from . import data as rstdat
def convert(path, file_in, config):
......@@ -21,6 +23,8 @@ def convert(path, file_in, config):
k: json.loads(config['parameters'][k])
for k in config['parameters']
}
else:
var = config
# possible inputs and linked helper functions
file_convert = {'.asc': readasc,
'.dat': readdat,
......@@ -397,3 +401,33 @@ def get_length(file_path):
with nptdms.TdmsFile.open(file_path) as tdms_file:
length = len(tdms_file['Untitled']['Shear Force'].time_track())
return length
def check_tdms(file_list, config):
"""
Checks if a tdms file on the list is longer than allowed. If yes then the
data is automatically downsampled.
"""
max_len = 0
for file_name in tqdm(file_list, desc='Checking TDMS file length'):
cur_len = get_length(
os.path.join(config['paths']['path_in'], file_name)
)
if cur_len > max_len:
max_len = cur_len
if max_len > config.getint('parameters', 'nsamples'):
print(
'Converting folder. Raw data files will be moved to raw_data.'
)
raw_folder = os.path.join(config['paths']['path_in'], 'raw_data')
os.makedirs(
raw_folder,
exist_ok=True
)
for file_name in tqdm(file_list, desc='Downsampling Files'):
file_path = os.path.join(config['paths']['path_in'], file_name)
new_path = os.path.join(raw_folder, file_name)
shutil.move(file_path, new_path)
new_file_path = downsample_file(new_path)
shutil.move(new_file_path, file_path)
......@@ -8,7 +8,7 @@ import sys
import tkinter as tk
from tkinter import filedialog, messagebox
import rstevaluation.tools.interface.processing as rstprocess
from . import processing as rstprocess
class RST_pick_GUI(tk.Tk):
......@@ -324,6 +324,16 @@ class RST_pick_GUI(tk.Tk):
vars['options'] = dict()
for opt in self.cfg['options'].keys():
vars['options'][opt] = self.cfg['options'][opt]
# Check if config path points to the correct directory otherwise create
# a new config in the project folder.
if not os.path.exists(self.path_cfg.get()):
self.path_cfg.set(
os.path.join(
self.path_in.get(),
self.projectname.get() + '.cfg'
)
)
with open(self.path_cfg.get(), 'w') as f:
self.cfg.write(f)
......
......@@ -4,9 +4,10 @@ import os
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
import rstevaluation.tools.analysis as rst_analysis
import scipy.stats as stats
from . import analysis as rst_analysis
# ===================LINEAR REGRESSION=========================================
def plotstd(path, name, strength, fricdata):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment