From 3f4919ffe77e3e8abef44a1fe8b4581747a05af5 Mon Sep 17 00:00:00 2001 From: "TCS portal test user (insilicolab@gmail.com)" Date: Fri, 29 Mar 2024 11:16:43 +0100 Subject: [PATCH] ISL-4698 Fixed python script so it reads provided data properly --- sample_app.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sample_app.py b/sample_app.py index 93a9ac1..6142701 100644 --- a/sample_app.py +++ b/sample_app.py @@ -5,7 +5,7 @@ # Sample function created for demonstration of creating custom applications functionality # See also https://docs.cyfronet.pl/display/ISDOC/Creating+Custom+Applications -from numpy import loadtxt +import numpy as np import matplotlib.pyplot as plt def main(numbers_file, multiplier): @@ -20,8 +20,10 @@ def main(numbers_file, multiplier): numbers. """ - numbers = loadtxt(numbers_file, comments="#", delimiter=",", unpack=False) + numbers = np.genfromtxt(numbers_file, comments="#", delimiter=",", unpack=False) + numbers = numbers[~np.isnan(numbers)] + numbers = np.array(numbers).flatten() multiplied_numbers = numbers * multiplier plt.figure() plt.plot(multiplied_numbers) - plt.savefig('multiplied_numbers_plot.png') + plt.savefig('multiplied_numbers_plot.png') \ No newline at end of file