<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Performance Overview
Here, we will example the performance of FNGS as a function of time on several datasets. These investigations were performed on a 4 core machine (4 threads) with a 4.0 GhZ processor.
BNU1
Step1:  HNU Dataset
Step2:  DC1 Dataset
<ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import numpy as np
import re
import matplotlib.pyplot as plt
def memory_function(infile, dataset):
    with open(infile, 'r') as mem:
        lines = mem.readlines()
    testar = np.asarray([line.strip() for line in lines]).astype(float)/1000
    fig=plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(range(0, testar.shape[0]), testar - min(testar))
    ax.set_ylabel('memory usage in GB')
    ax.set_xlabel('Time (s)')
    ax.set_title(dataset + ' single subject Memory Usage; max = %.2f GB; mean = %.2f GB' % (max(testar), np.mean(testar)))
    return fig
def cpu_function(infile, dataset):
    with open(infile, 'r') as mem:
        lines = mem.readlines()
    testar = np.asarray([line.strip() for line in lines]).astype(float)
    fig=plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(range(0, testar.shape[0]), testar)
    ax.set_ylabel('CPU usage (%)')
    ax.set_xlabel('Time (s)')
    ax.set_title(dataset + ' single subject Processor Usage; max = %.1f per; mean = %.1f per' % (max(testar), np.mean(testar)))
    return fig
def disk_function(infile, dataset):
    with open(infile, 'r') as mem:
        lines = mem.readlines()
    testar = np.asarray([line.strip() for line in lines]).astype(float)/1000000
    fig=plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(range(0, testar.shape[0]), testar - min(testar))
    ax.set_ylabel('Disk usage GB')
    ax.set_xlabel('Time (s)')
    ax.set_title(dataset + ' single subject Disk Usage; max = %.1f GB; mean = %.1f GB' % (max(testar), np.mean(testar)))
    return fig
memfig = memory_function('BNU_sub/output_single/membnu_single.txt', 'BNU 1')
diskfig = disk_function('HNU_sub/output_single/diskhnu_single.txt', 'BNU 1')
cpufig = cpu_function('BNU_sub/output_single/cpubnu_single.txt', 'BNU 1')
memfig.show()
diskfig.show()
cpufig.show()
Explanation: Performance Overview
Here, we will example the performance of FNGS as a function of time on several datasets. These investigations were performed on a 4 core machine (4 threads) with a 4.0 GhZ processor.
BNU1
End of explanation
memfig = memory_function('HNU_sub/output_single/memhnu_single.txt', 'HNU 1')
diskfig = disk_function('HNU_sub/output_single/diskhnu_single.txt', 'HNU 1')
cpufig = cpu_function('HNU_sub/output_single/cpuhnu_single.txt', 'HNU 1')
memfig.show()
diskfig.show()
cpufig.show()
Explanation: HNU Dataset
End of explanation
memfig = memory_function('DC_sub/output_single/memsingle.txt', 'DC 1')
diskfig = disk_function('DC_sub/output_single/disksingle.txt', 'DC 1')
cpufig = cpu_function('DC_sub/output_single/cpusingle.txt', 'DC 1')
memfig.show()
diskfig.show()
cpufig.show()
Explanation: DC1 Dataset
End of explanation
<END_TASK>