forked from tcs-test-user/PythonSampleApp
Added application code
This commit is contained in:
parent
627c0f1244
commit
667d2acc75
@ -1,15 +1,27 @@
|
|||||||
# This function was automatically generated. When modifying its signature, take care to apply
|
# -----------------
|
||||||
# modifications also to the descriptor files in the repository.
|
# Copyright © 2022 ACK Cyfronet AGH, Poland.
|
||||||
|
# -----------------
|
||||||
|
#
|
||||||
|
# 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 matplotlib.pyplot as plt
|
||||||
|
|
||||||
def main(numbers_file, multiplier):
|
def main(numbers_file, multiplier):
|
||||||
"""
|
"""
|
||||||
Main function for application: PYTHONSAMPLEAPP
|
Example Python application that reads the given numbers_file and multiplies
|
||||||
|
the content (numbers) by the supplied multiplier
|
||||||
Arguments:
|
Arguments:
|
||||||
numbers_file: path to input file of type 'text_data'
|
numbers_file: path to input file of type 'text_data'
|
||||||
multiplier: parameter of type 'INTEGER'
|
multiplier: number by which the array of numbers is multiplied
|
||||||
Returns:
|
Returns:
|
||||||
A file named 'multiplied_numbers_plot.png' of type 'image_data' and format 'PNG'
|
A file named 'multiplied_numbers_plot.png' containing a plot of multiplied
|
||||||
|
numbers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO: Put your application code here
|
numbers = loadtxt(numbers_file, comments="#", delimiter=",", unpack=False)
|
||||||
|
multiplied_numbers = numbers * multiplier
|
||||||
|
plt.figure()
|
||||||
|
plt.plot(multiplied_numbers)
|
||||||
|
plt.savefig('multiplied_numbers_plot.png')
|
||||||
|
Loading…
Reference in New Issue
Block a user