summaryrefslogtreecommitdiff
path: root/views/Redundant
diff options
context:
space:
mode:
Diffstat (limited to 'views/Redundant')
-rw-r--r--views/Redundant/__init__.py0
-rw-r--r--views/Redundant/__main__.py72
-rw-r--r--views/Redundant/demo.html1
-rw-r--r--views/Redundant/download.php58
-rw-r--r--views/Redundant/image.php19
-rw-r--r--views/Redundant/netlist.txt14
-rw-r--r--views/Redundant/python code backup/__main__.py59
-rw-r--r--views/Redundant/python code backup/__main__1.py64
-rw-r--r--views/Redundant/python code backup/with matplotlib change.py64
-rw-r--r--views/Redundant/screenshorts/Screenshot from 2015-10-14 15_10_50.pngbin0 -> 83775 bytes
-rw-r--r--views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_03.pngbin0 -> 87330 bytes
-rw-r--r--views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_14.pngbin0 -> 98539 bytes
-rw-r--r--views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_44.pngbin0 -> 116979 bytes
13 files changed, 351 insertions, 0 deletions
diff --git a/views/Redundant/__init__.py b/views/Redundant/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/views/Redundant/__init__.py
diff --git a/views/Redundant/__main__.py b/views/Redundant/__main__.py
new file mode 100644
index 0000000..0291884
--- /dev/null
+++ b/views/Redundant/__main__.py
@@ -0,0 +1,72 @@
+import os
+import sys
+import numpy as np
+
+import matplotlib
+# Force matplotlib to not use any Xwindows backend.
+matplotlib.use('Agg')
+
+import matplotlib.pyplot as plt
+
+def get_plot_files(file):
+ open_file = open(os.path.realpath(file),'r')
+ raw_data = open_file.read()
+ array = raw_data.split('* ')
+
+ array.pop(0)
+ dict_data = {}
+ parameters = []
+ parsed_files = []
+ dir1 = str(file)
+
+
+ if not os.path.exists(dir1[:-4]):
+ os.makedirs(dir1[:-4])
+
+
+ for i in range(len(array)):
+ dict_data[i] = array[i]
+
+ sample = dict_data[i].split('\n')
+ write_file = open(os.path.realpath(dir1[:-4])+'/parsed_%s.txt'%(i),'w')
+
+ for j in sample[3:]:
+ if j.startswith('Index'):
+ items = j.split()
+ parameters.append(items) if len(parameters) < i+1 else None
+ continue
+ if j.startswith('--') or '*' in j:
+ continue
+ else:
+ write_file.write(j+'\n')
+
+ parsed_files.append(os.path.realpath(dir1[:-4])+'/parsed_%s.txt'%(i))
+ return parameters, parsed_files
+
+def loudew(file):
+ parameters, parsed_files = get_plot_files(file)
+
+ for plot_file, parameter in zip(parsed_files, parameters):
+ data = np.loadtxt(plot_file, unpack=True, dtype=str)
+ for i in range(2, len(data)):
+
+ plt.plot([x.strip(',') for x in data[1]], [y.strip(',') for y in data[i]])
+
+ try:
+ plt.xlabel(parameter[1]), plt.ylabel(parameter[i])
+ plt.title('%s vs %s'%(parameter[1], parameter[i]))
+ plt.savefig(plot_file+str(i)+'.png'), plt.clf()
+ except IndexError:
+ plt.xlabel(parameter[1]), plt.ylabel('missing y label')
+ plt.title('%s vs missing y label'%(parameter[1], ))
+ plt.savefig(plot_file+str(i)+'.png'), plt.clf()
+
+
+def main():
+
+ files = sys.argv[1:]
+ for fi in files:
+ loudew(fi)
+
+if __name__ == '__main__':
+ main()
diff --git a/views/Redundant/demo.html b/views/Redundant/demo.html
new file mode 100644
index 0000000..afa6675
--- /dev/null
+++ b/views/Redundant/demo.html
@@ -0,0 +1 @@
+<img src="/eSIM/dump/parsed_0.txt2.png"></img>
diff --git a/views/Redundant/download.php b/views/Redundant/download.php
new file mode 100644
index 0000000..a0ecaf7
--- /dev/null
+++ b/views/Redundant/download.php
@@ -0,0 +1,58 @@
+<?php
+
+if (isset ($_POST["netlist"]))
+{
+ $netlistval = $_POST["netlist"]; // for ajax
+ //$netlistval = "CONTENT"; // without ajax
+ $myfile = fopen("netlist.txt", "w") or die("Unable to open file!");
+ fwrite($myfile, $netlistval);
+ fclose($myfile);
+
+/*
+
+ //echo "file written";
+
+
+
+ if ( $netlistval == null ) {
+ echo "fail";
+ // $response['status'] = 'error';
+ // $response['message'] = 'This failed';
+ } else if ( $netlistval != null )
+{ echo "success";
+ // $response['status'] = 'success';
+ // $response['message'] = 'This was successful';
+
+
+ }
+
+ // echo json_encode($response);
+
+ */
+}
+else
+{
+
+
+
+/*-------------------------------------------------------------------------------------------------------------------------------------------------
+FILE DOWNLOAD CODE PHP
+-------------------------------------------------------------------------------------------------------------------------------------------------*/
+ header('Content-Type: application/octet-stream');
+ header('Content-Disposition: attachment; filename='.basename('netlist.txt'));
+ header('Expires: 0');
+ header('Cache-Control: must-revalidate');
+ header('Pragma: public');
+ header('Content-Length: ' . filesize('netlist.txt'));
+ readfile('/var/www/html/eSIM/netlist.txt');
+ exit;
+
+
+}
+
+
+
+
+//echo "file download start";
+
+?>
diff --git a/views/Redundant/image.php b/views/Redundant/image.php
new file mode 100644
index 0000000..5ba14c5
--- /dev/null
+++ b/views/Redundant/image.php
@@ -0,0 +1,19 @@
+<?php
+$my_img = imagecreate( 200, 80 );
+$background = imagecolorallocate( $my_img, 0, 0, 255 );
+$text_colour = imagecolorallocate( $my_img, 255, 255, 0 );
+$line_colour = imagecolorallocate( $my_img, 128, 255, 0 );
+imagestring( $my_img, 4, 30, 25, "thesitewizard.com", $text_colour );
+imagesetthickness ( $my_img, 5 );
+imageline( $my_img, 30, 45, 165, 45, $line_colour );
+
+header( "Content-type: image/png" );
+imagepng( $my_img );
+imagecolordeallocate( $line_color );
+imagecolordeallocate( $text_color );
+imagecolordeallocate( $background );
+imagedestroy( $my_img );
+?>
+
+
+
diff --git a/views/Redundant/netlist.txt b/views/Redundant/netlist.txt
new file mode 100644
index 0000000..dbcff26
--- /dev/null
+++ b/views/Redundant/netlist.txt
@@ -0,0 +1,14 @@
+*ngspice netlist by niel mishra*
+v1 1 0 sin(0 5 1khz)
+c1 2 0 1pf
+d1 1 3 diode
+r1 3 2 10
+
+.tran 1e-03 100e-03 1e-03
+
+.control
+run
+print allv > dumpv.txt
+print alli > dumpi.txt
+.endc
+.end
diff --git a/views/Redundant/python code backup/__main__.py b/views/Redundant/python code backup/__main__.py
new file mode 100644
index 0000000..05b21d9
--- /dev/null
+++ b/views/Redundant/python code backup/__main__.py
@@ -0,0 +1,59 @@
+import os
+import sys
+import numpy as np
+
+import matplotlib
+# Force matplotlib to not use any Xwindows backend.
+matplotlib.use('Agg')
+
+import matplotlib.pyplot as plt
+
+def get_plot_files(file):
+ open_file = open(os.path.realpath(file),'r')
+ raw_data = open_file.read()
+ array = raw_data.split('* ')
+
+ array.pop(0)
+ dict_data = {}
+ parameters = []
+ parsed_files = []
+ for i in range(len(array)):
+ dict_data[i] = array[i]
+
+ sample = dict_data[i].split('\n')
+ write_file = open('parsed_%s.txt'%(i),'w')
+
+ for j in sample[3:]:
+ if j.startswith('Index'):
+ items = j.split()
+ parameters.append(items) if len(parameters) < i+1 else None
+ continue
+ if j.startswith('--'):
+ continue
+ else:
+ write_file.write(j+'\n')
+
+ parsed_files.append('parsed_%s.txt'%(i))
+ return parameters, parsed_files
+
+def main():
+
+ file = sys.argv[1]
+ parameters, parsed_files = get_plot_files(file)
+
+ for plot_file, parameter in zip(parsed_files, parameters):
+ data = np.loadtxt(plot_file, unpack=True, dtype=str)
+ for i in range(2, len(data)):
+
+ plt.plot([x.strip(',') for x in data[1]], [y.strip(',') for y in data[i]])
+ try:
+ plt.xlabel(parameter[1]), plt.ylabel(parameter[i])
+ plt.title('%s vs %s'%(parameter[1], parameter[i]))
+ plt.savefig(plot_file+str(i)+'.png'), plt.clf()
+ except IndexError:
+ plt.xlabel(parameter[1]), plt.ylabel('missing y label')
+ plt.title('%s vs missing y label'%(parameter[1], ))
+ plt.savefig(plot_file+str(i)+'.png'), plt.clf()
+
+if __name__ == '__main__':
+ main()
diff --git a/views/Redundant/python code backup/__main__1.py b/views/Redundant/python code backup/__main__1.py
new file mode 100644
index 0000000..134ccec
--- /dev/null
+++ b/views/Redundant/python code backup/__main__1.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+__name__ = '__main__'
+import os
+import sys
+import numpy as np
+
+import matplotlib
+# Force matplotlib to not use any Xwindows backend.
+matplotlib.use('Agg')
+
+import matplotlib.pyplot as plt
+
+
+def get_plot_files(file):
+ open_file = open(os.path.realpath(file),'r')
+ raw_data = open_file.read()
+ array = raw_data.split('* ')
+
+ array.pop(0)
+ dict_data = {}
+ parameters = []
+ parsed_files = []
+ for i in range(len(array)):
+ dict_data[i] = array[i]
+
+ sample = dict_data[i].split('\n')
+
+ write_file = open('parsed_%s.txt'%(i),'w')
+
+ for j in sample[3:]:
+
+ if j.startswith('Index'):
+ items = j.split()
+ parameters.append(items) if len(parameters) < i+1 else None
+ continue
+ if j.startswith('--'): #or j.startswith('/home') or j.startswith('Transient') or j.startswith(' Transient'):
+ continue
+ else:
+ write_file.write(j+'\n')
+
+ parsed_files.append('parsed_%s.txt'%(i))
+ return parameters, parsed_files
+
+
+
+
+def mai1n():
+
+ file = sys.argv[1]
+ parameters, parsed_files = get_plot_files(file)
+
+ for plot_file in parsed_files:
+
+ for item in parameters:
+ data= np.loadtxt(plot_file, unpack= True, dtype= str)
+
+ for i in range(2, len(data)):
+ plt.figure(i-1), plt.plot(data[1], data[i])
+ plt.xlabel(item[1]), plt.ylabel(item[i])
+ #plt.title('%s => %s vs %s'%(plot_file,item[1], item[i]))
+ plt.savefig(plot_file+str(i)+'.png')
+
+
+mai1n()
diff --git a/views/Redundant/python code backup/with matplotlib change.py b/views/Redundant/python code backup/with matplotlib change.py
new file mode 100644
index 0000000..134ccec
--- /dev/null
+++ b/views/Redundant/python code backup/with matplotlib change.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+__name__ = '__main__'
+import os
+import sys
+import numpy as np
+
+import matplotlib
+# Force matplotlib to not use any Xwindows backend.
+matplotlib.use('Agg')
+
+import matplotlib.pyplot as plt
+
+
+def get_plot_files(file):
+ open_file = open(os.path.realpath(file),'r')
+ raw_data = open_file.read()
+ array = raw_data.split('* ')
+
+ array.pop(0)
+ dict_data = {}
+ parameters = []
+ parsed_files = []
+ for i in range(len(array)):
+ dict_data[i] = array[i]
+
+ sample = dict_data[i].split('\n')
+
+ write_file = open('parsed_%s.txt'%(i),'w')
+
+ for j in sample[3:]:
+
+ if j.startswith('Index'):
+ items = j.split()
+ parameters.append(items) if len(parameters) < i+1 else None
+ continue
+ if j.startswith('--'): #or j.startswith('/home') or j.startswith('Transient') or j.startswith(' Transient'):
+ continue
+ else:
+ write_file.write(j+'\n')
+
+ parsed_files.append('parsed_%s.txt'%(i))
+ return parameters, parsed_files
+
+
+
+
+def mai1n():
+
+ file = sys.argv[1]
+ parameters, parsed_files = get_plot_files(file)
+
+ for plot_file in parsed_files:
+
+ for item in parameters:
+ data= np.loadtxt(plot_file, unpack= True, dtype= str)
+
+ for i in range(2, len(data)):
+ plt.figure(i-1), plt.plot(data[1], data[i])
+ plt.xlabel(item[1]), plt.ylabel(item[i])
+ #plt.title('%s => %s vs %s'%(plot_file,item[1], item[i]))
+ plt.savefig(plot_file+str(i)+'.png')
+
+
+mai1n()
diff --git a/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_10_50.png b/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_10_50.png
new file mode 100644
index 0000000..9b6ee9a
--- /dev/null
+++ b/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_10_50.png
Binary files differ
diff --git a/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_03.png b/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_03.png
new file mode 100644
index 0000000..03d2d52
--- /dev/null
+++ b/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_03.png
Binary files differ
diff --git a/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_14.png b/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_14.png
new file mode 100644
index 0000000..3c93db5
--- /dev/null
+++ b/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_14.png
Binary files differ
diff --git a/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_44.png b/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_44.png
new file mode 100644
index 0000000..b89db79
--- /dev/null
+++ b/views/Redundant/screenshorts/Screenshot from 2015-10-14 15_11_44.png
Binary files differ