Skip to content
Snippets Groups Projects
Commit 20ca8d16 authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Unified print commands.

parent 34ab215a
No related branches found
No related tags found
No related merge requests found
......@@ -197,8 +197,8 @@ class TrainingDataGenerator:
"""
# print(type(init_cond_list))
troubled_indicator = 'without' if is_smooth else 'with'
print('Calculating data ' + troubled_indicator + ' troubled cells...')
print('Samples to complete:', num_samples)
print(f'Calculating data {troubled_indicator} troubled cells...')
print(f'Samples to complete: {num_samples}')
tic = time.perf_counter()
num_datapoints = stencil_len
......@@ -241,11 +241,11 @@ class TrainingDataGenerator:
count += 1
if count % 1000 == 0:
print(str(count) + ' samples completed.')
print(f'{count} samples completed.')
toc = time.perf_counter()
print('Finished calculating data ' + troubled_indicator +
' troubled cells!')
print(f'Finished calculating data {troubled_indicator} '
f'troubled cells!')
print(f'Calculation time: {toc - tic:0.4f}s\n')
# Set output data
......
......@@ -138,7 +138,7 @@ class ModelTrainer:
# Train with validation
if verbose:
print('\nTraining model...')
print('Number of epochs:', num_epochs)
print(f'Number of epochs: {num_epochs}')
tic_train = time.perf_counter()
for epoch in range(num_epochs):
self._model.train()
......@@ -305,7 +305,7 @@ def evaluate_models(models: dict, directory: str, num_iterations: int = 100,
# Train models for evaluation
print('\nTraining models with 5-fold cross validation...')
print('Number of iterations:', num_iterations)
print(f'Number of iterations: {num_iterations}')
tic_train = time.perf_counter()
classification_stats = {}
for iteration in range(num_iterations):
......@@ -330,7 +330,7 @@ def evaluate_models(models: dict, directory: str, num_iterations: int = 100,
result[measure])
# Report status
if iteration+1 % max(10, 10*(num_iterations//100)):
print(iteration+1, 'iterations completed.')
print(f'{iteration+1} iterations completed.')
toc_train = time.perf_counter()
print('Finished training models with 5-fold cross validation!')
print(f'Training time: {toc_train - tic_train:0.4f}s\n')
......
......@@ -461,9 +461,9 @@ def plot_results(projection: ndarray, troubled_cell_history: list,
plot_semilog_error(grid, pointwise_error)
plot_error(grid, exact, approx)
print('p =', basis.polynomial_degree)
print('N =', mesh.num_cells)
print('maximum error =', max_error)
print(f'p = {basis.polynomial_degree}')
print(f'N = {mesh.num_cells}')
print(f'maximum error = {max_error:e}')
def _check_colors(colors: dict) -> dict:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment