diff --git a/sample_app.py b/sample_app.py index 403d027..e889601 100644 --- a/sample_app.py +++ b/sample_app.py @@ -1,15 +1,23 @@ -# This function was automatically generated. When modifying its signature, take care to apply -# modifications also to the descriptor files in the repository. +import numpy as np +import matplotlib.pyplot as plt def main(numbers_files, multiplier): """ - Main function for application: PYTHONSAMPLEAPPMULTIPLEFILES + Example Python application that reads the given numbers_files and multiplies + the content (numbers) by the supplied multiplier Arguments: - numbers_files: path to input file of type 'text_data' - multiplier: parameter of type 'INTEGER' + numbers_files: list of paths to input files of type 'text_data' + multiplier: number by which the arrays of numbers are multiplied Returns: - File(s) named 'multiplied_numbers_plot.png' of type 'image_data' and format 'PNG' from working directory + A file named 'multiplied_numbers_plot.png' containing a plot of multiplied + numbers. """ - # TODO: Put your application code here - + plt.figure() + for numbers_file in numbers_files: + numbers = np.genfromtxt(numbers_file, comments="#", delimiter=",", unpack=False) + numbers = numbers[~np.isnan(numbers)] + numbers = np.array(numbers).flatten() + multiplied_numbers = numbers * multiplier + plt.plot(multiplied_numbers) + plt.savefig('multiplied_numbers_plot.png') \ No newline at end of file