Compare commits

...

7 Commits

3 changed files with 8 additions and 6 deletions

View File

@ -1,9 +1,9 @@
# PythonSampleApp
This application shows:
- basic usage of input files in Python applications
- basic usage of input files in Python applications
- creating and returning output file in Python application
- declaring Matplotlib dependency
Contents of the repository:
- [appDefinition.json](appDefinition.json) - application definition descriptor

View File

@ -1,5 +1,5 @@
{
"scriptLanguage" : "PYTHON_3",
"scriptLanguage" : "PYTHON",
"executableScriptName" : "sample_app.py",
"inputFiles" : [ {
"dataType" : "text_data",
@ -18,6 +18,6 @@
"fileName" : "multiplied_numbers_plot.png",
"isReturnedValue" : false
} ],
"requiredTools" : [ "python3" ],
"requiredTools" : [ "python3", "python-matplotlib" ],
"requiredComputationResources" : { }
}

View File

@ -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')