From caf3b6f38ef4ce2fd627d59780966cc843ee6b7c Mon Sep 17 00:00:00 2001 From: = Date: Sat, 12 Sep 2015 17:38:20 -0400 Subject: [PATCH 1/4] parse args with docopt if its installed --- bashplotlib/histogram.py | 27 ++++++-- bashplotlib/utils/commandhelp.py | 110 ++++++++++++++++++++++++++++--- bin/hist | 47 ++++--------- 3 files changed, 134 insertions(+), 50 deletions(-) diff --git a/bashplotlib/histogram.py b/bashplotlib/histogram.py index 2041d4a..8bb99ba 100644 --- a/bashplotlib/histogram.py +++ b/bashplotlib/histogram.py @@ -1,9 +1,8 @@ #!/usr/bin/python import math import optparse -import sys +import sys, os from utils.helpers import * -from utils.commandhelp import hist def calc_bins(n, min_val, max_val, h=None): "calculate number of bins for the histogram" @@ -14,14 +13,30 @@ def calc_bins(n, min_val, max_val, h=None): yield b def read_numbers(numbers): - "read the input data in the most optimal way" + "read the input data in the most optimal way. skip NA values." + if numbers is None: + return if isinstance(numbers, list): for n in numbers: - n = str(n) - yield float(n.strip()) + if n: + n = str(n) + try: + yield float(n.strip()) + except Exception, err: + # sys.stderr.write(str(n)) + # sys.stderr.write(err.message) + # sys.stderr.flush() + continue else: for n in open(numbers): - yield float(n.strip()) + if n: + try: + yield float(n.strip()) + except Exception, err: + # sys.stderr.write(str(n)) + # sys.stderr.write(err.message) + # sys.stderr.flush() + continue def run_demo(): "demo the product" diff --git a/bashplotlib/utils/commandhelp.py b/bashplotlib/utils/commandhelp.py index 8670563..f9f4093 100644 --- a/bashplotlib/utils/commandhelp.py +++ b/bashplotlib/utils/commandhelp.py @@ -1,14 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""commandhelp.py +""" +import sys +import os +from bashplotlib.utils.helpers import * +from select import select -hist = { - "usage": """hist is a command for making histograms. it accepts a series of values in one of the following formats: - 1) txt file w/ 1 column of numbers - 2) standard in piped from another command line cat or curl - - for some examples of how to use hist, you can type the command: - hist --demo - or visit https://github.com/glamp/bashplotlib/blob/master/examples/sample.sh - """ -} +HIST_DOCSTRING = """hist + +Usage: + hist [[FILE -f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] + +Arguments: + FILE A file containing a column of numbers [default: stdin] + -f --file FILENAME Same as FILE but shorter and less explicit [default: stdin] + -t --title TITLE Title for the chart [default: ] + -b --bins BINS Number of bins in the histogram [default: None] + -s --height SIZE Height of the histogram in lines [default: 20.0] + -p --pch MARKERSHAPE Shape of each bar [default: o] + -x --xlab XLAB Label bins on x-axis [default: None] + -c --colour COLOUR Colour of the plot (Pink, blue, green, red, white, aqua, grey, yellow) [default: white] + +Options: + -n --nosummary Hide summary + -h --help Show this screen + +Examples: + $ hist test.csv -t "you're the man now dog" + $ hist -f test.csv -t "you're the man now dog" + $ hist --file test.csv -t "you're the man now dog" + $ cat test.csv | hist -t "you're the man now dog" + +""" + +HIST_OPTPARSE_ARGUMENTS = [ + {"short":"-f","long":"--file","description":"a file containing a column of numbers","default": None, "dest": "FILE"}, + {"short":"-t","long":"--title","description":"title for the chart","default": "", "dest": "TITLE"}, + {"short":"-b","long":"--bins","description":"number of bins in the histogram","default": None, "dest": "BINS"}, + {"short":"-s","long":"--height","description":"height of the histogram (in lines)","default": 20.0, "dest": "SIZE"}, + {"short":"-p","long":"--pch","description":"shape of each bar","default":"o", "dest": "MARKERSHAPE"}, + {"short":"-x","long":"--xlab","description":"label bins on x-axis","default": None, "dest": "XLAB"}, + {"short":"-c","long":"--colour","description":"colour of the plot (pink, blue, green, red, white, aqua, grey, yellow)","default":"white", "dest": "COLOUR"}, + {"short":"-n","long":"--nosummary","description":"hide summary","default": True, "dest": "SHOWSUMMARY"} +] scatter = { "usage": """scatterplot is a command for making xy plots. it accepts a series of x values and a series of y values in the @@ -22,3 +57,58 @@ """ } +def _read_stdin_or_timeout(): + timeout = 0.5 + rlist, _, _ = select([sys.stdin], [], [], timeout) + if rlist: + return sys.stdin.readlines() + else: + return None + +def parse_hist_args_with_docopt(): + from docopt import docopt + args = docopt(HIST_DOCSTRING) + for k, v in args.iteritems(): + if v == 'None': + args[k] = None + if args['FILE'] and args['FILE'] != args['--file']: + args['--file'] = args['FILE'] + if args['--file'] == 'stdin': + args['--file'] = _read_stdin_or_timeout() + if args['--file'] is None: + print HIST_DOCSTRING + sys.exit(1) + plot_params = { + 'bincount': args['--bins'], + 'colour': args['--colour'], + 'f': args['--file'], + 'height': float(args['--height'].strip()), + 'pch': args['--pch'], + 'showSummary': (not args['--nosummary']), + 'title': args['--title'], + 'xlab': args['--xlab'] + } + return plot_params + +def parse_hist_args_with_optparse(): + import optparse + parser = optparse.OptionParser(usage=HIST_DOCSTRING) + for opt in HIST_OPTPARSE_ARGUMENTS: + parser.add_option(opt['short'], opt['long'], help=opt['description'],default=opt['default'], dest=opt['dest']) + (opts, args) = parser.parse_args() + if opts.FILE is None: + if len(args) > 0: + opts.FILE = args[0] + else: + opts.FILE = _read_stdin_or_timeout() + plot_params = { + 'bincount': opts.BINS, + 'colour': opts.COLOUR, + 'f': opts.FILE, + 'height': float(opts.SIZE), + 'pch': opts.MARKERSHAPE, + 'showSummary': opts.SHOWSUMMARY, + 'title': opts.TITLE, + 'xlab': opts.XLAB + } + return plot_params diff --git a/bin/hist b/bin/hist index 24bf9c9..112433a 100755 --- a/bin/hist +++ b/bin/hist @@ -1,39 +1,18 @@ #!/usr/bin/env python -import optparse -import sys -from bashplotlib.utils.commandhelp import hist -from bashplotlib.utils.helpers import * +# -*- coding: utf-8 -*- +import sys, os +from bashplotlib.utils.commandhelp import HIST_DOCSTRING as __doc__ from bashplotlib.histogram import plot_hist +try: + import docopt + from bashplotlib.utils.commandhelp import parse_hist_args_with_docopt as parse_args +except ImportError: + from bashplotlib.utils.commandhelp import parse_hist_args_with_optparse as parse_args -if __name__=="__main__": - - parser = optparse.OptionParser(usage=hist['usage']) - - parser.add_option('-f', '--file', help='a file containing a column of numbers', - default=None, dest='f') - parser.add_option('-t', '--title', help='title for the chart', - default="", dest='t') - parser.add_option('-b', '--bins', help='number of bins in the histogram', - type='int', default=None, dest='b') - parser.add_option('-s', '--height', help='height of the histogram (in lines)', - type='int', default=20., dest='h') - parser.add_option('-p', '--pch', help='shape of each bar', default='o', dest='p') - parser.add_option('-x', '--xlab', help='label bins on x-axis', default=None, action="store_true", dest='x') - parser.add_option('-c', '--colour', help='colour of the plot (%s)' % ", ".join([c for c in bcolours.keys() if c != 'ENDC']), - default='white', dest='colour') - parser.add_option('-n', '--nosummary', help='hide summary', action='store_false', dest='showSummary', default=True) - - (opts, args) = parser.parse_args() - - if opts.f is None: - if len(args) > 0: - opts.f = args[0] - else: - opts.f = sys.stdin.readlines() - - if opts.f: - plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t, opts.x, opts.showSummary) - else: - print "nothing to plot!" +def main(): + plot_params = parse_args() + plot_hist(**plot_params) +if __name__ == "__main__": + main() From a669e0254d83b90a723a2a5e81ba606c416795a8 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 12 Sep 2015 18:17:22 -0400 Subject: [PATCH 2/4] started to remove optparse --- bashplotlib/utils/commandhelp.py | 56 +++++++++----------------------- bin/hist | 9 ++--- 2 files changed, 18 insertions(+), 47 deletions(-) diff --git a/bashplotlib/utils/commandhelp.py b/bashplotlib/utils/commandhelp.py index f9f4093..19a6a61 100644 --- a/bashplotlib/utils/commandhelp.py +++ b/bashplotlib/utils/commandhelp.py @@ -4,13 +4,14 @@ """ import sys import os +from docopt import docopt from bashplotlib.utils.helpers import * from select import select -HIST_DOCSTRING = """hist +HIST_DOCSTRING = """hist - construct a histogram for a continuous variable from your terminal Usage: - hist [[FILE -f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] + hist [[FILE | -f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] Arguments: FILE A file containing a column of numbers [default: stdin] @@ -23,7 +24,7 @@ -c --colour COLOUR Colour of the plot (Pink, blue, green, red, white, aqua, grey, yellow) [default: white] Options: - -n --nosummary Hide summary + -n --nosummary Hide summary -h --help Show this screen Examples: @@ -34,16 +35,13 @@ """ -HIST_OPTPARSE_ARGUMENTS = [ - {"short":"-f","long":"--file","description":"a file containing a column of numbers","default": None, "dest": "FILE"}, - {"short":"-t","long":"--title","description":"title for the chart","default": "", "dest": "TITLE"}, - {"short":"-b","long":"--bins","description":"number of bins in the histogram","default": None, "dest": "BINS"}, - {"short":"-s","long":"--height","description":"height of the histogram (in lines)","default": 20.0, "dest": "SIZE"}, - {"short":"-p","long":"--pch","description":"shape of each bar","default":"o", "dest": "MARKERSHAPE"}, - {"short":"-x","long":"--xlab","description":"label bins on x-axis","default": None, "dest": "XLAB"}, - {"short":"-c","long":"--colour","description":"colour of the plot (pink, blue, green, red, white, aqua, grey, yellow)","default":"white", "dest": "COLOUR"}, - {"short":"-n","long":"--nosummary","description":"hide summary","default": True, "dest": "SHOWSUMMARY"} -] +# SCATTER_DOCSTRING = """scatter - construct a scatter plot from your terminal + +# Usage: +# scatter [[FILE | -f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] + + +# """ scatter = { "usage": """scatterplot is a command for making xy plots. it accepts a series of x values and a series of y values in the @@ -65,9 +63,10 @@ def _read_stdin_or_timeout(): else: return None -def parse_hist_args_with_docopt(): - from docopt import docopt - args = docopt(HIST_DOCSTRING) +def parse_args(command_docstring): + """takes __doc__ for given cmd. Returns parsed args using docopt. + """ + args = docopt(command_docstring) for k, v in args.iteritems(): if v == 'None': args[k] = None @@ -76,7 +75,7 @@ def parse_hist_args_with_docopt(): if args['--file'] == 'stdin': args['--file'] = _read_stdin_or_timeout() if args['--file'] is None: - print HIST_DOCSTRING + print command_docstring sys.exit(1) plot_params = { 'bincount': args['--bins'], @@ -89,26 +88,3 @@ def parse_hist_args_with_docopt(): 'xlab': args['--xlab'] } return plot_params - -def parse_hist_args_with_optparse(): - import optparse - parser = optparse.OptionParser(usage=HIST_DOCSTRING) - for opt in HIST_OPTPARSE_ARGUMENTS: - parser.add_option(opt['short'], opt['long'], help=opt['description'],default=opt['default'], dest=opt['dest']) - (opts, args) = parser.parse_args() - if opts.FILE is None: - if len(args) > 0: - opts.FILE = args[0] - else: - opts.FILE = _read_stdin_or_timeout() - plot_params = { - 'bincount': opts.BINS, - 'colour': opts.COLOUR, - 'f': opts.FILE, - 'height': float(opts.SIZE), - 'pch': opts.MARKERSHAPE, - 'showSummary': opts.SHOWSUMMARY, - 'title': opts.TITLE, - 'xlab': opts.XLAB - } - return plot_params diff --git a/bin/hist b/bin/hist index 112433a..96db831 100755 --- a/bin/hist +++ b/bin/hist @@ -3,15 +3,10 @@ import sys, os from bashplotlib.utils.commandhelp import HIST_DOCSTRING as __doc__ from bashplotlib.histogram import plot_hist - -try: - import docopt - from bashplotlib.utils.commandhelp import parse_hist_args_with_docopt as parse_args -except ImportError: - from bashplotlib.utils.commandhelp import parse_hist_args_with_optparse as parse_args +from bashplotlib.utils.commandhelp import parse_args def main(): - plot_params = parse_args() + plot_params = parse_args(__doc__) plot_hist(**plot_params) if __name__ == "__main__": From 77942b9a9dd7cffdc3094db0ebd0148e4a51b35c Mon Sep 17 00:00:00 2001 From: = Date: Sun, 13 Sep 2015 14:31:48 -0400 Subject: [PATCH 3/4] read x/y pairs from a file with or without headers --- bashplotlib/__init__.py | 9 + bashplotlib/cli/__init__.py | 4 + bashplotlib/cli/demo.py | 26 + bashplotlib/cli/helpers.py | 16 + .../{utils/commandhelp.py => cli/hist.py} | 52 +- bashplotlib/cli/scatter.py | 20 + bashplotlib/cli/scatter2.py | 93 ++ bashplotlib/core/__init__.py | 4 + bashplotlib/core/histogram.py | 126 +++ bashplotlib/{ => core}/scatterplot.py | 36 +- bashplotlib/histogram.py | 199 ---- bashplotlib/utils/__init__.py | 4 + bashplotlib/utils/helpers.py | 16 +- bin/hist | 11 +- data/xydata-headers.csv | 1001 +++++++++++++++++ data/xydata.csv | 1001 +++++++++++++++++ 16 files changed, 2337 insertions(+), 281 deletions(-) create mode 100644 bashplotlib/cli/__init__.py create mode 100644 bashplotlib/cli/demo.py create mode 100644 bashplotlib/cli/helpers.py rename bashplotlib/{utils/commandhelp.py => cli/hist.py} (57%) create mode 100644 bashplotlib/cli/scatter.py create mode 100644 bashplotlib/cli/scatter2.py create mode 100644 bashplotlib/core/__init__.py create mode 100644 bashplotlib/core/histogram.py rename bashplotlib/{ => core}/scatterplot.py (58%) delete mode 100644 bashplotlib/histogram.py create mode 100644 data/xydata-headers.csv create mode 100644 data/xydata.csv diff --git a/bashplotlib/__init__.py b/bashplotlib/__init__.py index e69de29..465b34f 100644 --- a/bashplotlib/__init__.py +++ b/bashplotlib/__init__.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""bashplotlib/__init__.py +""" + +import os, sys + +PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) + diff --git a/bashplotlib/cli/__init__.py b/bashplotlib/cli/__init__.py new file mode 100644 index 0000000..f8c7260 --- /dev/null +++ b/bashplotlib/cli/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""cli/__init__.py +""" diff --git a/bashplotlib/cli/demo.py b/bashplotlib/cli/demo.py new file mode 100644 index 0000000..9dfda91 --- /dev/null +++ b/bashplotlib/cli/demo.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""demo.py +""" +import os, sys +from bashplotlib.cli.hist import __doc__ as HIST_DOCSTRING +from bashplotlib.core.histogram import plot_hist +from bashplotlib import PROJECT_ROOT + +DATA_PATH = os.path.realpath(os.path.join(PROJECT_ROOT, '..', 'data')) + +if not os.path.exists(DATA_PATH): + sys.stderr.write('You need to download the example data set to run the demo...') + sys.stderr.write('try running `./examples/downloaddata.sh` to get the data') + sys.exit(1) + +def _hist_demo(): + f = os.path.join(DATA_PATH, 'exp.txt') + print f + plot_hist(f) + +def run_demo(command): + if command == "hist": + _hist_demo() + elif command == "scatter": + raise NotImplementedError('`run_demo` is only implemented for `hist` cmd so far.') diff --git a/bashplotlib/cli/helpers.py b/bashplotlib/cli/helpers.py new file mode 100644 index 0000000..eba29aa --- /dev/null +++ b/bashplotlib/cli/helpers.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""cli/helpers.py +""" +import sys, os +from select import select + +def read_stdin_or_timeout(): + """Try reading stdin. give up in 0.5s if nothing read yet.""" + timeout = 0.5 + rlist, _, _ = select([sys.stdin], [], [], timeout) + if rlist: + return sys.stdin.readlines() + else: + return None + diff --git a/bashplotlib/utils/commandhelp.py b/bashplotlib/cli/hist.py similarity index 57% rename from bashplotlib/utils/commandhelp.py rename to bashplotlib/cli/hist.py index 19a6a61..8214872 100644 --- a/bashplotlib/utils/commandhelp.py +++ b/bashplotlib/cli/hist.py @@ -1,17 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -"""commandhelp.py -""" -import sys -import os -from docopt import docopt -from bashplotlib.utils.helpers import * -from select import select - -HIST_DOCSTRING = """hist - construct a histogram for a continuous variable from your terminal +"""hist - construct a histogram for a continuous variable from your terminal Usage: - hist [[FILE | -f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] + hist [[FILE|-f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] Arguments: FILE A file containing a column of numbers [default: stdin] @@ -34,53 +26,27 @@ $ cat test.csv | hist -t "you're the man now dog" """ +from docopt import docopt +from bashplotlib.cli.helpers import read_stdin_or_timeout -# SCATTER_DOCSTRING = """scatter - construct a scatter plot from your terminal - -# Usage: -# scatter [[FILE | -f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] - - -# """ - -scatter = { - "usage": """scatterplot is a command for making xy plots. it accepts a series of x values and a series of y values in the - following formats: - 1) a txt file or standard in value w/ 2 comma seperated columns of x,y values - 2) 2 txt files. 1 w/ designated x values and another with designated y values. - - scatter -x -y - cat | scatter - - """ -} - -def _read_stdin_or_timeout(): - timeout = 0.5 - rlist, _, _ = select([sys.stdin], [], [], timeout) - if rlist: - return sys.stdin.readlines() - else: - return None - -def parse_args(command_docstring): +def parse_args(): """takes __doc__ for given cmd. Returns parsed args using docopt. """ - args = docopt(command_docstring) + args = docopt(__doc__) for k, v in args.iteritems(): if v == 'None': args[k] = None if args['FILE'] and args['FILE'] != args['--file']: args['--file'] = args['FILE'] if args['--file'] == 'stdin': - args['--file'] = _read_stdin_or_timeout() + args['--file'] = read_stdin_or_timeout() if args['--file'] is None: - print command_docstring + print __doc__ sys.exit(1) plot_params = { 'bincount': args['--bins'], 'colour': args['--colour'], - 'f': args['--file'], + 'data': args['--file'], 'height': float(args['--height'].strip()), 'pch': args['--pch'], 'showSummary': (not args['--nosummary']), diff --git a/bashplotlib/cli/scatter.py b/bashplotlib/cli/scatter.py new file mode 100644 index 0000000..c229289 --- /dev/null +++ b/bashplotlib/cli/scatter.py @@ -0,0 +1,20 @@ +scatter = { + "usage": """scatterplot is a command for making xy plots. it accepts a series of x values and a series of y values in the + following formats: + 1) a txt file or standard in value w/ 2 comma seperated columns of x,y values + 2) 2 txt files. 1 w/ designated x values and another with designated y values. + + scatter -x -y + cat | scatter + + """ +} + + +# SCATTER_DOCSTRING = """scatter - construct a scatter plot from your terminal + +# Usage: +# scatter [X Y] + + +# """ diff --git a/bashplotlib/cli/scatter2.py b/bashplotlib/cli/scatter2.py new file mode 100644 index 0000000..3452abd --- /dev/null +++ b/bashplotlib/cli/scatter2.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""scatter2 + +Usage: + scatter2 [[FILE|-f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] + +Arguments: + FILE Csv with 2 columns for x and y [default: ] + -f --file FILENAME Same as FILE but shorter and less explicit [default: ] + -t --title TITLE Title for the chart [default: ] + -X --X-vals X X values + -y --y-vals y y values + -s --size SIZE Height of the histogram in lines [default: 20.0] + -p --pch MARKERSHAPE Shape of each bar [default: x] + -c --colour COLOUR Colour of the plot (Pink, blue, green, red, white, aqua, grey, yellow) [default: white] + +Options: + -n --nosummary Hide summary + -h --help Show this screen + +Examples: + $ hist test.csv -t "you're the man now dog" + $ hist -f test.csv -t "you're the man now dog" + $ hist --file test.csv -t "you're the man now dog" + $ cat test.csv | hist -t "you're the man now dog" + +""" +from docopt import docopt +from bashplotlib.cli.helpers import read_stdin_or_timeout +from bashplotlib.utils.helpers import try_cast_str_to_number + +def _read_csv(filename, X=0, y=1, sep=',', header=False): + X_y_pairs = [] + with open(filename, 'r') as f: + data = [line.strip() for line in f.readlines()] + if not data: + return None + else: + if isinstance(X, int) and isinstance(y, int): + X_idx, y_idx = X, y + elif isinstance(X, basestring) and isinstance(y, basestring): + if X.strip().isdigit() and y.strip().isdigit(): + X_idx, y_idx = map(try_cast_str_to_number, [X_idx, y_idx]) + else: + X_idx, y_idx = None, None + for i, line in enumerate(data): + row = [item.strip() for item in line.strip().split(sep)] + if i == 0: + if header: + for j, col in enumerate(row): + if col.lower() == X.lower(): + X_idx = j + if col.lower() == y.lower(): + y_idx = j + if X_idx and y_idx: + continue + if row and isinstance(row, list) and len(row): + try: + X_value, y_value = row[X_idx], row[y_idx] + X_value, y_value = map(try_cast_str_to_number, [X_value, y_value]) + X_y_pairs.append([X_value, y_value]) + except Exception, err: + continue + return X_y_pairs + + +# # plot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t) +# def parse_args(): +# """takes __doc__ for given cmd. Returns parsed args using docopt. +# """ +# args = docopt() +# for k, v in args.iteritems(): +# if v == 'None': +# args[k] = None +# if args['FILE'] and args['FILE'] != args['--file']: +# args['--file'] = args['FILE'] +# if args['--file'] == 'stdin': +# args['--file'] = read_stdin_or_timeout() +# if args['--file'] is None: +# print +# sys.exit(1) +# plot_params = { +# 'bincount': args['--bins'], +# 'colour': args['--colour'], +# 'data': args['--file'], +# 'height': float(args['--height'].strip()), +# 'pch': args['--pch'], +# 'showSummary': (not args['--nosummary']), +# 'title': args['--title'], +# 'xlab': args['--xlab'] +# } +# return plot_params diff --git a/bashplotlib/core/__init__.py b/bashplotlib/core/__init__.py new file mode 100644 index 0000000..e0af725 --- /dev/null +++ b/bashplotlib/core/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""core/__init__.py +""" diff --git a/bashplotlib/core/histogram.py b/bashplotlib/core/histogram.py new file mode 100644 index 0000000..4ff908a --- /dev/null +++ b/bashplotlib/core/histogram.py @@ -0,0 +1,126 @@ +#!/usr/bin/python +import math +import sys, os +from bashplotlib.utils import helpers +import collections + +def calc_bins(n, min_val, max_val, h=None): + "calculate number of bins for the histogram" + if not h: + h = max(10, math.log(n + 1, 2)) + bin_width = (max_val - min_val) / h + for b in helpers.drange(min_val, max_val, bin_width): + yield b + +def read_numbers(numbers): + "read input optimally; skip NA values. Takes a list() or a file." + if not numbers: + numbers = [] + if isinstance(numbers, basestring): + try: + # read numbers from file + # ignore empty rows + numbers = [line for line in open(numbers, 'r') if line.strip()] + except Exception, err: + pass + if isinstance(numbers, collections.Iterable): + for number in numbers: + number = helpers.try_cast_str_to_number(number) + if number: + yield number + + +def plot_hist(data, height=20.0, bincount=None, pch="o", colour="white", title="", xlab=None, showSummary=False): + """make a histogram for continuous variable. + + Arguments: + data: List of numbers or file with numbers + height: The height of the histogram in # of lines + bincount: Number of bins in the histogram + pch: Shape of the bars in the plot + colour: Colour of the bars in the terminal + title: Title at the top of the plot + xlab: Boolen value for whether or not to display x-axis labels + showSummary: Boolean value for whether or not to display a summary + """ + if pch is None: + pch = "o" + colour = helpers.get_colour(colour) + min_val, max_val = None, None + n, mean = 0., 0. + for number in read_numbers(data): + n += 1 + + if not min_val or number < min_val: + min_val = number + if not max_val or number > max_val: + max_val = number + mean += number + mean /= n + + bins = list(calc_bins(n, min_val, max_val, bincount)) + hist = {} + for i in range(len(bins)): + hist[i] = 0 + for number in read_numbers(data): + for i, b in enumerate(bins): + if number < b: + hist[i] += 1 + break + + min_y, max_y = min(hist.values()), max(hist.values()) + + ys = list(helpers.drange(min_y, max_y, (max_y-min_y)/height)) + ys.reverse() + + nlen = max(len(str(min_y)), len(str(max_y))) + 1 + + if title: + print helpers.box_text(title, len(hist)*2, nlen) + print + used_labs = set() + for y in ys: + ylab = str(int(y)) + if ylab in used_labs: + ylab = "" + else: + used_labs.add(ylab) + ylab = " "*(nlen - len(ylab)) + ylab + "|" + + print ylab, + + for i in range(len(hist)): + if y < hist[i]: + helpers.printcolor(pch, True, colour) + else: + helpers.printcolor(" ", True, colour) + print + xs = hist.keys() * 2 + + print " "*(nlen+1) + "-"*len(xs) + + + if xlab: + for i in range(0, nlen): + helpers.printcolor(" "*(nlen+1), True, colour) + for x in range(0, len(hist)): + num = str(bins[x]) + if x%2==0: + print " ", + elif i < len(num): + print num[i], + print + center = max(map(len, map(str, [n, min_val, mean, max_val]))) + center += 15 + + if showSummary: + print + print "-"*(2 + center) + print "|" + "Summary".center(center) + "|" + print "-"*(2 + center) + summary = "|" + ("observations: %d" % n).center(center) + "|\n" + summary += "|" + ("min value: %f" % min_val).center(center) + "|\n" + summary += "|" + ("mean : %f" % mean).center(center) + "|\n" + summary += "|" + ("max value: %f" % max_val).center(center) + "|\n" + summary += "-"*(2 + center) + print summary diff --git a/bashplotlib/scatterplot.py b/bashplotlib/core/scatterplot.py similarity index 58% rename from bashplotlib/scatterplot.py rename to bashplotlib/core/scatterplot.py index db4a38e..558b32d 100644 --- a/bashplotlib/scatterplot.py +++ b/bashplotlib/core/scatterplot.py @@ -2,7 +2,7 @@ import csv import optparse import sys -from utils.helpers import * +from bashplotlib.utils import helpers from utils.commandhelp import scatter @@ -10,7 +10,7 @@ def get_scale(series, is_y=False, steps=20): min_val = min(series) max_val = max(series) scaled_series = [] - for x in drange(min_val, max_val, (max_val-min_val)/steps): + for x in helpers.drange(min_val, max_val, (max_val-min_val)/steps): if x > 0 and scaled_series and max(scaled_series) < 0: scaled_series.append(0.0) scaled_series.append(x) @@ -43,12 +43,12 @@ def plot_scatter(f, xs, ys, size, pch, colour, title): xs = [float(str(row).strip()) for row in open(xs)] ys = [float(str(row).strip()) for row in open(ys)] - colour = get_colour(colour) + colour = helpers.get_colour(colour) plotted = set() if title: - print box_text(title, 2*len(get_scale(xs, False, size))+1) + print helpers.box_text(title, 2*len(get_scale(xs, False, size))+1) print "-"*(2*len(get_scale(xs, False, size))+2) for y in get_scale(ys, True, size): @@ -71,31 +71,3 @@ def plot_scatter(f, xs, ys, size, pch, colour, title): print "-"*(2*len(get_scale(xs, False, size))+2) -if __name__=="__main__": - - parser = optparse.OptionParser(usage=scatter['usage']) - parser.add_option('-f', '--file', help='a csv w/ x and y coordinates', - default=None, dest='f') - parser.add_option('-t', '--title', help='title for the chart', - default="", dest='t') - parser.add_option('-x', help='x coordinates', - default=None, dest='x') - parser.add_option('-y', help='y coordinates', - default=None, dest='y') - parser.add_option('-s', '--size',help='y coordinates', - default=20, dest='size', type='int') - parser.add_option('-p', '--pch',help='shape of point', - default="x", dest='pch') - parser.add_option('-c', '--colour', help='colour of the plot (%s)' % ", ".join(bcolours.keys()), - default='white', dest='colour') - - (opts, args) = parser.parse_args() - - if opts.f is None and (opts.x is None or opts.y is None): - opts.f = sys.stdin.readlines() - - if opts.f or (opts.x and opts.y): - plot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t) - else: - print "nothing to plot!" - diff --git a/bashplotlib/histogram.py b/bashplotlib/histogram.py deleted file mode 100644 index 8bb99ba..0000000 --- a/bashplotlib/histogram.py +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/python -import math -import optparse -import sys, os -from utils.helpers import * - -def calc_bins(n, min_val, max_val, h=None): - "calculate number of bins for the histogram" - if not h: - h = max(10, math.log(n + 1, 2)) - bin_width = (max_val - min_val) / h - for b in drange(min_val, max_val, bin_width): - yield b - -def read_numbers(numbers): - "read the input data in the most optimal way. skip NA values." - if numbers is None: - return - if isinstance(numbers, list): - for n in numbers: - if n: - n = str(n) - try: - yield float(n.strip()) - except Exception, err: - # sys.stderr.write(str(n)) - # sys.stderr.write(err.message) - # sys.stderr.flush() - continue - else: - for n in open(numbers): - if n: - try: - yield float(n.strip()) - except Exception, err: - # sys.stderr.write(str(n)) - # sys.stderr.write(err.message) - # sys.stderr.flush() - continue - -def run_demo(): - "demo the product" - #plotting a histogram - print "plotting a basic histogram" - print "plot_hist('./data/exp.txt')" - print "hist -f ./data/exp.txt" - print "cat ./data/exp.txt | hist" - plot_hist('./data/exp.txt') - print "*"*80 - #with colors - print "histogram with colors" - print "plot_hist('./data/exp.txt', colour='blue')" - print "hist -f ./data/exp.txt -c blue" - plot_hist('./data/exp.txt', colour='blue') - print "*"*80 - #changing the shape of the point - print "changing the shape of the bars" - print "plot_hist('./data/exp.txt', pch='.')" - print "hist -f ./data/exp.txt -p ." - plot_hist('./data/exp.txt', pch='.') - print "*"*80 - #chagning the size of the plot - print "chagning the size of the plot" - print "plot_hist('./data/exp.txt', height=35.0, bincount=40)" - print "hist -f ./data/exp.txt -s 35.0 -b 40" - plot_hist('./data/exp.txt', height=35.0, bincount=40) - -def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="", xlab=None, showSummary=False): - """make a histogram - - Keyword arguments: - height -- the height of the histogram in # of lines - bincount -- number of bins in the histogram - pch -- shape of the bars in the plot - colour -- colour of the bars in the terminal - title -- title at the top of the plot - xlab -- boolen value for whether or not to display x-axis labels - showSummary -- boolean value for whether or not to display a summary - """ - - if pch is None: - pch = "o" - - colour = get_colour(colour) - - min_val, max_val = None, None - n, mean = 0., 0. - for number in read_numbers(f): - n += 1 - - if not min_val or number < min_val: - min_val = number - if not max_val or number > max_val: - max_val = number - mean += number - mean /= n - - bins = list(calc_bins(n, min_val, max_val, bincount)) - hist = {} - for i in range(len(bins)): - hist[i] = 0 - for number in read_numbers(f): - for i, b in enumerate(bins): - if number < b: - hist[i] += 1 - break - - min_y, max_y = min(hist.values()), max(hist.values()) - - ys = list(drange(min_y, max_y, (max_y-min_y)/height)) - ys.reverse() - - nlen = max(len(str(min_y)), len(str(max_y))) + 1 - - if title: - print box_text(title, len(hist)*2, nlen) - print - used_labs = set() - for y in ys: - ylab = str(int(y)) - if ylab in used_labs: - ylab = "" - else: - used_labs.add(ylab) - ylab = " "*(nlen - len(ylab)) + ylab + "|" - - print ylab, - - for i in range(len(hist)): - if y < hist[i]: - printcolor(pch, True, colour) - else: - printcolor(" ", True, colour) - print - xs = hist.keys() * 2 - - print " "*(nlen+1) + "-"*len(xs) - - - if xlab: - for i in range(0, nlen): - printcolor(" "*(nlen+1), True, colour) - for x in range(0, len(hist)): - num = str(bins[x]) - if x%2==0: - print " ", - elif i < len(num): - print num[i], - print - center = max(map(len, map(str, [n, min_val, mean, max_val]))) - center += 15 - - if showSummary: - print - print "-"*(2 + center) - print "|" + "Summary".center(center) + "|" - print "-"*(2 + center) - summary = "|" + ("observations: %d" % n).center(center) + "|\n" - summary += "|" + ("min value: %f" % min_val).center(center) + "|\n" - summary += "|" + ("mean : %f" % mean).center(center) + "|\n" - summary += "|" + ("max value: %f" % max_val).center(center) + "|\n" - summary += "-"*(2 + center) - print summary - - -if __name__=="__main__": - - parser = optparse.OptionParser(usage=hist['usage']) - - parser.add_option('-f', '--file', help='a file containing a column of numbers', - default=None, dest='f') - parser.add_option('-t', '--title', help='title for the chart', - default="", dest='t') - parser.add_option('-b', '--bins', help='number of bins in the histogram', - type='int', default=None, dest='b') - parser.add_option('-s', '--height', help='height of the histogram (in lines)', - type='int', default=20., dest='h') - parser.add_option('-p', '--pch', help='shape of each bar', default='o', dest='p') - parser.add_option('-x', '--xlab', help='label bins on x-axis', default=None, action="store_true", dest='x') - parser.add_option('-c', '--colour', help='colour of the plot (%s)' % ", ".join([c for c in bcolours.keys() if c != 'ENDC']), - default='white', dest='colour') - parser.add_option('-d', '--demo', help='run demos', action='store_true', dest='demo') - parser.add_option('-n', '--nosummary', help='hide summary', action='store_false', dest='showSummary', default=True) - - (opts, args) = parser.parse_args() - - if opts.f is None: - if len(args) > 0: - opts.f = args[0] - elif opts.demo is False: - opts.f = sys.stdin.readlines() - - if opts.demo: - run_demo() - elif opts.f: - plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t, opts.x, opts.showSummary) - else: - print "nothing to plot!" - diff --git a/bashplotlib/utils/__init__.py b/bashplotlib/utils/__init__.py index e69de29..a079ae6 100644 --- a/bashplotlib/utils/__init__.py +++ b/bashplotlib/utils/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""utils/__init__.py +""" diff --git a/bashplotlib/utils/helpers.py b/bashplotlib/utils/helpers.py index ffe0176..9a86400 100644 --- a/bashplotlib/utils/helpers.py +++ b/bashplotlib/utils/helpers.py @@ -1,4 +1,8 @@ - +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""utils/helpers.py +""" +import os, sys bcolours = { "white": '\033[97m', @@ -42,4 +46,12 @@ def box_text(text, width, offset=0): box += " "*offset + "-"*(width+2) return box - +def try_cast_str_to_number(number_str, verbose=False): + "takes txt and tries to coerce it to float" + try: + return float(number_str.strip()) + except Exception, err: + if verbose: + sys.stderr.write(err.message) + sys.stderr.flush() + return None diff --git a/bin/hist b/bin/hist index 96db831..a93e149 100755 --- a/bin/hist +++ b/bin/hist @@ -1,12 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import sys, os -from bashplotlib.utils.commandhelp import HIST_DOCSTRING as __doc__ -from bashplotlib.histogram import plot_hist -from bashplotlib.utils.commandhelp import parse_args +import os, sys +from bashplotlib.cli.hist import __doc__ +from bashplotlib.cli.hist import parse_args +from bashplotlib.core.histogram import plot_hist + def main(): - plot_params = parse_args(__doc__) + plot_params = parse_args() plot_hist(**plot_params) if __name__ == "__main__": diff --git a/data/xydata-headers.csv b/data/xydata-headers.csv new file mode 100644 index 0000000..726cb65 --- /dev/null +++ b/data/xydata-headers.csv @@ -0,0 +1,1001 @@ +X,y +609,-0.451972008537 +153,0.806400580775 +276,-0.444085660041 +63,0.167355700303 +565,-0.467691874215 +76,0.566107636898 +609,-0.451972008537 +525,-0.346677730585 +834,-0.995692578437 +169,-0.601999867678 +375,-0.912957551683 +526,-0.976597351709 +78,0.513978455988 +270,-0.176045946471 +309,0.901801374964 +56,-0.521551002087 +358,-0.141090165312 +110,-0.0442426780851 +879,-0.601951726281 +303,0.986632504844 +282,-0.676749764526 +305,-0.262403941862 +274,-0.629911406685 +320,-0.428155428084 +891,-0.936430249298 +307,-0.768235364237 +235,0.58058664099 +150,-0.714876429629 +686,0.905603933565 +747,-0.643491986364 +256,-0.999208034107 +716,-0.279357610266 +731,0.836622615127 +33,0.999911860107 +864,-0.0619805101619 +589,-0.998818156774 +894,0.976571411323 +461,0.727121806057 +834,-0.995692578437 +585,0.616087948358 +319,-0.99177499561 +56,-0.521551002087 +703,-0.656941145733 +522,0.4755767043 +421,0.0265812877381 +743,0.999911057852 +468,0.0971519041799 +164,0.594932778023 +526,-0.976597351709 +341,0.99060323339 +629,0.629934818523 +983,0.313142898892 +352,0.141149850679 +561,0.974635157271 +30,-0.988031624093 +981,0.733251813681 +144,-0.491021593898 +567,0.998348825812 +29,-0.663633884213 +321,0.529108265482 +556,0.0618601641251 +938,0.972609050321 +975,0.894037180613 +513,-0.795842349412 +546,-0.594884318359 +831,0.998812289042 +862,0.933342168368 +210,0.467718518343 +617,0.948301276912 +605,0.970520754664 +812,0.994832914021 +811,0.452079564177 +789,-0.44416668483 +368,-0.420194391032 +600,0.0441824483319 +593,0.689654284798 +395,-0.745093055724 +138,-0.228052259501 +285,0.773871590208 +228,0.972623062486 +200,-0.873297297214 +293,-0.739200998751 +226,-0.193443817159 +799,0.860100162164 +738,0.270847753553 +938,0.972609050321 +389,-0.529057106277 +399,-0.0177320647274 +584,-0.329933913491 +941,-0.995678592782 +890,-0.801188714661 +138,-0.228052259501 +635,0.387837205897 +924,0.363255622392 +822,-0.889968112962 +494,-0.696101773472 +629,0.629934818523 +348,0.656963872524 +900,0.997803274422 +76,0.566107636898 +387,-0.551451828115 +721,-0.999989937914 +233,0.498739281803 +639,-0.951073282107 +438,-0.968371982886 +807,0.379551962389 +982,0.968341890464 +841,-0.811568164468 +55,-0.999755173359 +744,0.529031525954 +556,0.0618601641251 +862,0.933342168368 +706,0.756763086604 +739,-0.663678982428 +26,0.76255845048 +315,0.745133264557 +304,0.670206803781 +169,-0.601999867678 +397,0.916533604798 +861,0.20220892507 +809,-0.999204431621 +740,-0.988022322677 +737,0.956358313995 +561,0.974635157271 +814,-0.321679488026 +978,-0.821869357536 +322,0.999912259872 +212,-0.998347093797 +18,-0.750987246772 +410,0.999754505908 +426,-0.951045337532 +570,-0.980251583583 +737,0.956358313995 +503,0.3383617608 +929,-0.790377808879 +479,0.995689783115 +931,0.885966758301 +595,-0.945454974958 +389,-0.529057106277 +85,-0.176075619949 +480,0.616016713764 +386,0.404010070823 +278,0.999521091849 +840,-0.930128092016 +480,0.616016713764 +36,-0.991778853443 +754,0.0177622043332 +480,0.616016713764 +661,0.953770773362 +554,0.881813052519 +167,-0.475550186872 +109,0.816742606636 +763,0.395869787381 +503,0.3383617608 +119,-0.371404101438 +430,0.387753849637 +441,0.923470012926 +803,-0.948263002181 +906,0.939550700722 +490,-0.0883386596402 +545,-0.997801277005 +145,0.467745162045 +224,-0.811620997365 +353,0.90930997089 +197,0.79580584292 +590,-0.580562097239 +669,0.158563143108 +105,-0.970535283537 +27,0.956375928405 +750,0.745072950292 +859,-0.974662135376 +253,0.994823728671 +122,0.498713153896 +95,0.683261714736 +969,0.98360405829 +844,0.885896851207 +727,-0.961414079374 +97,0.379607739028 +687,0.846188278824 +797,-0.821783485626 +793,0.968379503791 +33,0.999911860107 +39,0.963795386284 +497,0.587819393981 +185,0.346621180094 +311,0.0176717854674 +122,0.498713153896 +824,0.785017737351 +544,-0.483344343168 +755,0.850935193971 +392,0.643515060153 +301,-0.558764049589 +864,-0.0619805101619 +580,0.930083804977 +944,0.998819621438 +721,-0.999989937914 +129,-0.193473392038 +127,0.972630067242 +91,0.105987511751 +568,0.587746231938 +622,-0.0353380517466 +397,0.916533604798 +747,-0.643491986364 +360,0.958915723414 +805,0.683305734714 +829,-0.371348124428 +869,0.939499081438 +401,-0.901775319514 +847,-0.942494306447 +33,0.999911860107 +491,0.790451671234 +445,-0.893983156305 +935,-0.930072731105 +526,-0.976597351709 +261,-0.245281209082 +862,0.933342168368 +440,0.176105293266 +474,0.371376113102 +53,0.395925150182 +605,0.970520754664 +427,-0.253794205503 +557,-0.806436232223 +135,0.088368686104 +258,0.379635626829 +973,-0.77940941514 +630,0.993881997013 +139,0.696080131225 +429,0.985141083712 +552,-0.795787588589 +751,-0.158682193925 +705,0.958941374547 +542,0.997168757104 +986,-0.444031641497 +287,-0.897940948108 +358,-0.141090165312 +149,-0.974648648094 +844,0.885896851207 +363,-0.989353860169 +848,-0.227993559054 +998,-0.85547315197 +609,-0.451972008537 +583,-0.972616056845 +508,-0.806382753952 +103,0.622988631442 +8,0.989358246623 +419,-0.920037850062 +135,0.088368686104 +796,-0.923481578009 +111,-0.864551448611 +872,-0.978437900469 +226,-0.193443817159 +834,-0.995692578437 +255,-0.506391634924 +673,0.643584278011 +303,0.986632504844 +242,-0.0972119075182 +470,-0.945425512269 +252,0.623012211004 +12,-0.536572918 +407,-0.986622678341 +728,-0.750947435767 +656,0.558739049819 +881,0.976603834587 +769,0.636691518553 +405,0.262345765308 +702,-0.989367016834 +510,0.873326667542 +958,0.18469286804 +779,-0.114724923353 +223,0.0530534852699 +218,-0.942524527329 +59,0.636738007139 +852,-0.58784378026 +622,-0.0353380517466 +825,0.945415689655 +655,0.999756505535 +228,0.972623062486 +240,0.945445154921 +403,0.768273957712 +188,-0.475523669012 +42,-0.916521547916 +501,-0.996471703572 +49,-0.953752652759 +671,-0.963779308975 +610,0.506417628279 +935,-0.930072731105 +713,0.141060322436 +427,-0.253794205503 +719,0.412063553628 +154,-0.0619203372561 +290,0.826845633922 +322,0.999912259872 +431,-0.566132485576 +369,-0.9906114771 +437,-0.313257409711 +835,-0.61599296778 +61,-0.966117770008 +6,-0.279415498199 +706,0.756763086604 +151,0.202149881416 +884,-0.936483119966 +290,0.826845633922 +715,-0.958907171294 +553,0.0796086403815 +422,0.855535586422 +27,0.956375928405 +897,-0.99716648991 +165,0.99779727945 +461,0.727121806057 +171,0.976590867944 +719,0.412063553628 +97,0.379607739028 +591,0.371460077098 +102,0.994826791358 +432,-0.999519224404 +452,-0.379579850881 +819,0.816707818437 +551,-0.939540378573 +723,0.420221744856 +763,0.395869787381 +235,0.58058664099 +546,-0.594884318359 +525,-0.346677730585 +382,-0.956367121635 +628,-0.313171527024 +400,-0.850919359639 +152,0.933320523749 +402,-0.123543209378 +205,-0.714897507768 +704,0.279473385116 +551,-0.939540378573 +47,0.123573122745 +76,0.566107636898 +354,0.841454697362 +326,-0.663611334201 +151,0.202149881416 +292,0.167325981012 +201,-0.0618902507187 +907,0.795769333535 +593,0.689654284798 +880,0.346706005358 +557,-0.806436232223 +301,-0.558764049589 +919,0.996461576338 +634,-0.566057938 +153,0.806400580775 +487,-0.0531136889739 +450,-0.683283725036 +757,0.123513295899 +913,0.933288050459 +754,0.0177622043332 +671,-0.963779308975 +518,0.354881993716 +516,0.702429241248 +809,-0.999204431621 +765,-0.999753837548 +666,-0.0176416458133 +850,0.980227731734 +200,-0.873297297214 +321,0.529108265482 +249,-0.727163193444 +141,0.363171365373 +338,-0.961389196822 +840,-0.930128092016 +392,0.643515060153 +987,0.514056027644 +370,-0.650264939561 +215,0.980245621957 +100,-0.50636564111 +752,-0.916545660847 +11,-0.999990206551 +78,0.513978455988 +933,0.0529932813731 +860,-0.714834271403 +424,0.11475486862 +80,-0.993888653923 +329,0.762538949168 +547,0.354966539136 +665,-0.850871852004 +271,0.733210818609 +416,0.966125549876 +67,-0.855519978975 +11,-0.999990206551 +858,-0.338390126969 +277,0.514004313674 +493,0.228022909381 +506,-0.202179403335 +494,-0.696101773472 +917,-0.338248293052 +75,-0.387781635409 +398,0.831758008719 +293,-0.739200998751 +841,-0.811568164468 +342,0.420139682239 +22,-0.0088513092904 +698,0.536623791889 +556,0.0618601641251 +180,-0.801152635734 +481,-0.330019281315 +349,-0.279444441784 +202,0.806418406866 +517,0.978444126076 +258,0.379635626829 +699,0.999990471553 +34,0.52908268612 +435,0.993891981024 +967,-0.573307778903 +846,-0.790470135028 +269,-0.923446880243 +939,0.32990545695 +753,-0.831741274054 +288,-0.855504370751 +53,0.395925150182 +117,-0.689697940935 +800,0.893969648197 +315,0.745133264557 +252,0.623012211004 +299,-0.521576721618 +247,0.926807185503 +462,-0.184811369732 +858,-0.338390126969 +310,0.850887688656 +473,0.981946467414 +967,-0.573307778903 +869,0.939499081438 +746,-0.991786566406 +270,-0.176045946471 +817,0.184840994735 +17,-0.96139749188 +710,6.02887066916e-05 +65,0.82682867949 +835,-0.61599296778 +800,0.893969648197 +762,0.986617763744 +900,0.997803274422 +953,-0.890036835409 +101,0.452025787178 +851,0.363115192377 +966,-0.999210431225 +266,0.860054026465 +946,-0.371488064422 +947,-0.981969268581 +812,0.994832914021 +255,-0.506391634924 +962,0.623059368428 +898,-0.475470631996 +821,-0.864581744786 +933,0.0529932813731 +273,0.313200154871 +363,-0.989353860169 +585,0.616087948358 +882,0.708616602137 +640,-0.773852498156 +556,0.0618601641251 +64,0.920026038197 +556,0.0618601641251 +504,0.974655392178 +765,-0.999753837548 +109,0.816742606636 +90,0.893996663601 +9,0.412118485242 +958,0.18469286804 +848,-0.227993559054 +811,0.452079564177 +331,-0.905591148197 +610,0.506417628279 +220,0.0883987124875 +327,0.270934805316 +521,-0.483265173349 +627,-0.968349414889 +936,-0.193384666873 +763,0.395869787381 +416,0.966125549876 +652,-0.992865461064 +563,-0.609091837945 +475,-0.580635726907 +630,0.993881997013 +214,0.363199451376 +529,0.936472547534 +224,-0.811620997365 +814,-0.321679488026 +203,0.933309700167 +394,-0.963803423625 +609,-0.451972008537 +974,0.10607743501 +250,-0.970528019542 +71,0.951054653254 +841,-0.811568164468 +585,0.616087948358 +344,-0.999990339506 +790,-0.993895307221 +647,-0.167296261569 +987,0.514056027644 +968,0.379691401398 +253,0.994823728671 +814,-0.321679488026 +11,-0.999990206551 +613,-0.379663514286 +491,0.790451671234 +319,-0.99177499561 +542,0.997168757104 +124,-0.995686986889 +838,0.720995935398 +265,0.894010170084 +336,0.149847405733 +303,0.986632504844 +796,-0.923481578009 +237,-0.981957869782 +699,0.999990471553 +549,0.702364872321 +500,-0.467771805322 +53,0.395925150182 +35,-0.428182669496 +210,0.467718518343 +782,0.253765048014 +722,-0.536522042161 +316,0.963787348067 +302,0.395952831043 +827,-0.689741594565 +155,-0.873311982775 +805,0.683305734714 +456,-0.452052675883 +579,0.811638606856 +547,0.354966539136 +288,-0.855504370751 +434,0.444139676971 +33,0.999911860107 +807,0.379551962389 +24,-0.905578362007 +643,0.855488761749 +790,-0.993895307221 +265,0.894010170084 +145,0.467745162045 +639,-0.951073282107 +544,-0.483344343168 +331,-0.905591148197 +194,-0.702386329268 +130,-0.930105950187 +252,0.623012211004 +666,-0.0176416458133 +283,0.25385251979 +132,0.0530835871461 +708,-0.909322514128 +628,-0.313171527024 +754,0.0177622043332 +546,-0.594884318359 +263,-0.779447185499 +682,-0.270963822078 +126,0.329990825674 +320,-0.428155428084 +334,0.8366721491 +826,0.236602816898 +75,-0.387781635409 +86,-0.923458447004 +655,0.999756505535 +754,0.0177622043332 +699,0.999990471553 +181,-0.936451400118 +254,0.451998898063 +370,-0.650264939561 +823,-0.0971219023783 +442,0.821800661502 +776,-0.026611421428 +651,-0.636784493411 +327,0.270934805316 +884,-0.936483119966 +40,0.745113160479 +461,0.727121806057 +71,0.951054653254 +95,0.683261714736 +190,0.997799278681 +828,-0.981940764891 +296,0.636761250565 +305,-0.262403941862 +513,-0.795842349412 +693,0.961380900891 +776,-0.026611421428 +95,0.683261714736 +52,0.98662759204 +578,-0.0530233833456 +189,0.483317953668 +181,-0.936451400118 +172,0.708659140182 +59,0.636738007139 +417,0.739160393875 +616,0.245310432473 +516,0.702429241248 +498,0.998343627044 +657,-0.395980511544 +167,-0.475550186872 +40,0.745113160479 +859,-0.974662135376 +754,0.0177622043332 +113,-0.0971819058932 +424,0.11475486862 +621,-0.860038646335 +82,0.313228782433 +239,0.236690681275 +110,-0.0442426780851 +938,0.972609050321 +994,0.951082595236 +74,-0.985146260468 +319,-0.99177499561 +152,0.933320523749 +93,-0.94828214127 +253,0.994823728671 +999,-0.0264607527371 +598,0.890023092537 +708,-0.909322514128 +287,-0.897940948108 +615,-0.683217692275 +738,0.270847753553 +80,-0.993888653923 +221,0.885938797879 +599,0.864521149292 +752,-0.916545660847 +66,-0.026551154024 +421,0.0265812877381 +559,-0.202090837026 +841,-0.811568164468 +477,-0.498687025536 +476,-0.998813757337 +718,0.989349472816 +808,-0.573431264777 +546,-0.594884318359 +483,-0.721016823278 +518,0.354881993716 +240,0.945445154921 +937,0.721100368243 +113,-0.0971819058932 +608,-0.99482066508 +752,-0.916545660847 +306,-0.953761713494 +997,-0.897967480498 +305,-0.262403941862 +78,0.513978455988 +806,0.983576865728 +577,-0.868935919429 +253,0.994823728671 +452,-0.379579850881 +134,0.88592481646 +594,-0.236719968971 +10,-0.544021110889 +53,0.395925150182 +892,-0.210722131299 +39,0.963795386284 +549,0.702364872321 +503,0.3383617608 +884,-0.936483119966 +192,-0.354938357652 +204,0.202120359313 +765,-0.999753837548 +645,-0.826862587603 +405,0.262345765308 +999,-0.0264607527371 +880,0.346706005358 +729,0.149936817113 +526,-0.976597351709 +102,0.994826791358 +146,0.996469173122 +618,0.779428300674 +950,0.945464794136 +737,0.956358313995 +219,-0.790414741493 +734,-0.905552787157 +496,-0.36314327904 +533,-0.877560883034 +638,-0.253881676588 +35,-0.428182669496 +455,0.506339646835 +166,0.483291563728 +753,-0.831741274054 +619,-0.106047460687 +501,-0.996471703572 +207,-0.338305027541 +155,-0.873311982775 +280,-0.387809420829 +14,0.990607355695 +833,-0.459957024351 +360,0.958915723414 +429,0.985141083712 +592,0.981963569628 +41,-0.158622668805 +758,-0.768293253402 +958,0.18469286804 +598,0.890023092537 +374,-0.149907013456 +646,-0.920002411959 +720,-0.544071696438 +560,0.714918585257 +751,-0.158682193925 +137,-0.942514454558 +618,0.779428300674 +39,0.963795386284 +774,0.92004966109 +543,0.47549715072 +825,0.945415689655 +314,-0.158592906029 +717,0.657032049317 +209,0.996466641766 +308,0.123603036 +328,0.956384734305 +806,0.983576865728 +817,0.184840994735 +871,-0.70245069628 +368,-0.420194391032 +971,-0.245339655642 +61,-0.966117770008 +661,0.953770773362 +56,-0.521551002087 +965,-0.506443621173 +836,0.330047736657 +578,-0.0530233833456 +558,-0.933298875737 +964,0.4519451186 +926,0.696015200688 +665,-0.850871852004 +678,-0.551376385992 +976,0.860023265424 +930,0.0884587650136 +699,0.999990471553 +462,-0.184811369732 +469,-0.784999063373 +858,-0.338390126969 +153,0.806400580775 +92,-0.779466069616 +344,-0.999990339506 +214,0.363199451376 +117,-0.689697940935 +498,0.998343627044 +515,-0.219395848565 +180,-0.801152635734 +877,-0.475603221295 +620,-0.894023675755 +231,-0.995684189758 +683,-0.956393539337 +658,-0.986637416751 +506,-0.202179403335 +329,0.762538949168 +439,-0.733169820872 +238,-0.68967611318 +197,0.79580584292 +259,0.983593183947 +203,0.933309700167 +101,0.452025787178 +697,-0.42011232727 +653,-0.436110502648 +540,-0.346592904377 +903,-0.978469019612 +240,0.945445154921 +524,0.601975797253 +740,-0.988022322677 +594,-0.236719968971 +990,-0.387864990612 +281,-0.985151436329 +393,-0.296397368652 +703,-0.656941145733 +852,-0.58784378026 +295,-0.30478191109 +210,0.467718518343 +69,-0.114784813783 +598,0.890023092537 +816,-0.727101111373 +145,0.467745162045 +843,0.868995589841 +756,0.901762290561 +806,0.983576865728 +200,-0.873297297214 +305,-0.262403941862 +52,0.98662759204 +527,-0.708637871481 +964,0.4519451186 +418,-0.167385419442 +294,-0.966109989263 +825,0.945415689655 +963,0.994817600584 +634,-0.566057938 +853,-0.998341892307 +501,-0.996471703572 +725,0.650242038374 +319,-0.99177499561 +630,0.993881997013 +794,0.733149321004 +791,-0.629841167736 +746,-0.991786566406 +611,0.99920923312 +528,0.210839999735 +963,0.994817600584 +87,-0.821817836631 +864,-0.0619805101619 +202,0.806418406866 +423,0.897914412455 +106,-0.727142500081 +948,-0.68963245579 +947,-0.981969268581 +670,-0.745153367958 +874,0.594981235525 +275,-0.99388532592 +725,0.650242038374 +355,-3.01443533595e-05 +501,-0.996471703572 +12,-0.536572918 +220,0.0883987124875 +66,-0.026551154024 +949,0.236749256451 +584,-0.329933913491 +835,-0.61599296778 +410,0.999754505908 +34,0.52908268612 +605,0.970520754664 +672,-0.296310998016 +854,-0.490969072656 +366,0.999990072687 +922,-0.998350556921 +658,-0.986637416751 +947,-0.981969268581 +692,0.751027055047 +68,-0.897927680689 +654,0.521602440676 +123,-0.45990349069 +57,0.436164755248 +765,-0.999753837548 +188,-0.475523669012 +923,-0.587721843522 +86,-0.923458447004 +152,0.933320523749 +663,-0.123632949143 +779,-0.114724923353 +880,0.346706005358 +827,-0.689741594565 +552,-0.795787588589 +262,-0.948291709522 +829,-0.371348124428 +582,-0.721079482984 +205,-0.714897507768 +610,0.506417628279 +943,0.498791536257 +475,-0.580635726907 +343,-0.536598355189 +564,-0.996464109505 +249,-0.727163193444 +671,-0.963779308975 +5,-0.958924274663 +144,-0.491021593898 +949,0.236749256451 +163,-0.354910175845 +577,-0.868935919429 +24,-0.905578362007 +680,0.988040921918 +588,-0.498765409257 +749,0.96381146009 +718,0.989349472816 +290,0.826845633922 +76,0.566107636898 +223,0.0530534852699 +5,-0.958924274663 +867,-0.0794884450788 +882,0.708616602137 +762,0.986617763744 +859,-0.974662135376 +167,-0.475550186872 +883,-0.210869466365 +819,0.816707818437 +40,0.745113160479 +292,0.167325981012 +792,0.313286036704 +216,0.696058488345 +437,-0.313257409711 +893,0.708722942421 +902,-0.354994720298 +468,0.0971519041799 +228,0.972623062486 +429,0.985141083712 +44,0.0177019251054 +323,0.551401533867 +60,-0.304810621102 +622,-0.0353380517466 +544,-0.483344343168 +182,-0.2107810659 +511,0.881770400761 +774,0.92004966109 +471,-0.236632105238 +39,0.963795386284 +841,-0.811568164468 +977,0.0353079262048 +311,0.0176717854674 +338,-0.961389196822 +858,-0.338390126969 +193,-0.978456574622 +894,0.976571411323 +884,-0.936483119966 +623,0.821852184648 +378,0.846236465698 +124,-0.995686986889 +49,-0.953752652759 +994,0.951082595236 +912,0.806454056848 +687,0.846188278824 +276,-0.444085660041 +900,0.997803274422 +197,0.79580584292 +749,0.96381146009 +130,-0.930105950187 +642,0.897954214711 +471,-0.236632105238 +726,-0.287961052193 +207,-0.338305027541 +132,0.0530835871461 +519,-0.594957007044 +553,0.0796086403815 +219,-0.790414741493 +316,0.963787348067 +290,0.826845633922 +303,0.986632504844 +168,-0.997173288774 +362,-0.657009324316 +511,0.881770400761 +338,-0.961389196822 +355,-3.01443533595e-05 +172,0.708659140182 +478,0.459930257729 +448,0.948272572156 +2,0.909297426826 +851,0.363115192377 +861,0.20220892507 +806,0.983576865728 +973,-0.77940941514 +120,0.580611184212 +665,-0.850871852004 +786,0.566157333739 +629,0.629934818523 +303,0.986632504844 +485,0.930117021524 +971,-0.245339655642 +212,-0.998347093797 +103,0.622988631442 +314,-0.158592906029 +7,0.656986598719 +675,0.428128186284 +673,0.643584278011 +991,-0.985161785365 +163,-0.354910175845 +843,0.868995589841 +456,-0.452052675883 +973,-0.77940941514 +148,-0.338333394324 +754,0.0177622043332 +355,-3.01443533595e-05 +431,-0.566132485576 +236,-0.371432089437 +945,0.580537552962 +650,0.304753200801 +707,-0.141179693171 +728,-0.750947435767 +603,-0.184722493715 +166,0.483291563728 +122,0.498713153896 +532,-0.877604238953 +303,0.986632504844 +425,-0.773909772204 +501,-0.996471703572 +51,0.670229175843 +644,0.0264908865234 +320,-0.428155428084 +198,-0.0795785916643 +794,0.733149321004 +281,-0.985151436329 +333,-0.00882116611389 +234,0.998816691203 +747,-0.643491986364 +782,0.253765048014 +746,-0.991786566406 +221,0.885938797879 +7,0.656986598719 +326,-0.663611334201 +647,-0.167296261569 +178,0.877575335804 +634,-0.566057938 +869,0.939499081438 +627,-0.968349414889 +813,0.622941470621 +409,0.558814047606 +328,0.956384734305 +470,-0.945425512269 +827,-0.689741594565 +57,0.436164755248 +882,0.708616602137 +457,-0.994829853142 +798,0.0354585535921 +115,0.945435334025 +817,0.184840994735 +786,0.566157333739 +643,0.855488761749 +429,0.985141083712 +321,0.529108265482 +453,0.573406568644 +725,0.650242038374 +502,-0.609020113022 +284,0.951063968113 +682,-0.270963822078 diff --git a/data/xydata.csv b/data/xydata.csv new file mode 100644 index 0000000..726cb65 --- /dev/null +++ b/data/xydata.csv @@ -0,0 +1,1001 @@ +X,y +609,-0.451972008537 +153,0.806400580775 +276,-0.444085660041 +63,0.167355700303 +565,-0.467691874215 +76,0.566107636898 +609,-0.451972008537 +525,-0.346677730585 +834,-0.995692578437 +169,-0.601999867678 +375,-0.912957551683 +526,-0.976597351709 +78,0.513978455988 +270,-0.176045946471 +309,0.901801374964 +56,-0.521551002087 +358,-0.141090165312 +110,-0.0442426780851 +879,-0.601951726281 +303,0.986632504844 +282,-0.676749764526 +305,-0.262403941862 +274,-0.629911406685 +320,-0.428155428084 +891,-0.936430249298 +307,-0.768235364237 +235,0.58058664099 +150,-0.714876429629 +686,0.905603933565 +747,-0.643491986364 +256,-0.999208034107 +716,-0.279357610266 +731,0.836622615127 +33,0.999911860107 +864,-0.0619805101619 +589,-0.998818156774 +894,0.976571411323 +461,0.727121806057 +834,-0.995692578437 +585,0.616087948358 +319,-0.99177499561 +56,-0.521551002087 +703,-0.656941145733 +522,0.4755767043 +421,0.0265812877381 +743,0.999911057852 +468,0.0971519041799 +164,0.594932778023 +526,-0.976597351709 +341,0.99060323339 +629,0.629934818523 +983,0.313142898892 +352,0.141149850679 +561,0.974635157271 +30,-0.988031624093 +981,0.733251813681 +144,-0.491021593898 +567,0.998348825812 +29,-0.663633884213 +321,0.529108265482 +556,0.0618601641251 +938,0.972609050321 +975,0.894037180613 +513,-0.795842349412 +546,-0.594884318359 +831,0.998812289042 +862,0.933342168368 +210,0.467718518343 +617,0.948301276912 +605,0.970520754664 +812,0.994832914021 +811,0.452079564177 +789,-0.44416668483 +368,-0.420194391032 +600,0.0441824483319 +593,0.689654284798 +395,-0.745093055724 +138,-0.228052259501 +285,0.773871590208 +228,0.972623062486 +200,-0.873297297214 +293,-0.739200998751 +226,-0.193443817159 +799,0.860100162164 +738,0.270847753553 +938,0.972609050321 +389,-0.529057106277 +399,-0.0177320647274 +584,-0.329933913491 +941,-0.995678592782 +890,-0.801188714661 +138,-0.228052259501 +635,0.387837205897 +924,0.363255622392 +822,-0.889968112962 +494,-0.696101773472 +629,0.629934818523 +348,0.656963872524 +900,0.997803274422 +76,0.566107636898 +387,-0.551451828115 +721,-0.999989937914 +233,0.498739281803 +639,-0.951073282107 +438,-0.968371982886 +807,0.379551962389 +982,0.968341890464 +841,-0.811568164468 +55,-0.999755173359 +744,0.529031525954 +556,0.0618601641251 +862,0.933342168368 +706,0.756763086604 +739,-0.663678982428 +26,0.76255845048 +315,0.745133264557 +304,0.670206803781 +169,-0.601999867678 +397,0.916533604798 +861,0.20220892507 +809,-0.999204431621 +740,-0.988022322677 +737,0.956358313995 +561,0.974635157271 +814,-0.321679488026 +978,-0.821869357536 +322,0.999912259872 +212,-0.998347093797 +18,-0.750987246772 +410,0.999754505908 +426,-0.951045337532 +570,-0.980251583583 +737,0.956358313995 +503,0.3383617608 +929,-0.790377808879 +479,0.995689783115 +931,0.885966758301 +595,-0.945454974958 +389,-0.529057106277 +85,-0.176075619949 +480,0.616016713764 +386,0.404010070823 +278,0.999521091849 +840,-0.930128092016 +480,0.616016713764 +36,-0.991778853443 +754,0.0177622043332 +480,0.616016713764 +661,0.953770773362 +554,0.881813052519 +167,-0.475550186872 +109,0.816742606636 +763,0.395869787381 +503,0.3383617608 +119,-0.371404101438 +430,0.387753849637 +441,0.923470012926 +803,-0.948263002181 +906,0.939550700722 +490,-0.0883386596402 +545,-0.997801277005 +145,0.467745162045 +224,-0.811620997365 +353,0.90930997089 +197,0.79580584292 +590,-0.580562097239 +669,0.158563143108 +105,-0.970535283537 +27,0.956375928405 +750,0.745072950292 +859,-0.974662135376 +253,0.994823728671 +122,0.498713153896 +95,0.683261714736 +969,0.98360405829 +844,0.885896851207 +727,-0.961414079374 +97,0.379607739028 +687,0.846188278824 +797,-0.821783485626 +793,0.968379503791 +33,0.999911860107 +39,0.963795386284 +497,0.587819393981 +185,0.346621180094 +311,0.0176717854674 +122,0.498713153896 +824,0.785017737351 +544,-0.483344343168 +755,0.850935193971 +392,0.643515060153 +301,-0.558764049589 +864,-0.0619805101619 +580,0.930083804977 +944,0.998819621438 +721,-0.999989937914 +129,-0.193473392038 +127,0.972630067242 +91,0.105987511751 +568,0.587746231938 +622,-0.0353380517466 +397,0.916533604798 +747,-0.643491986364 +360,0.958915723414 +805,0.683305734714 +829,-0.371348124428 +869,0.939499081438 +401,-0.901775319514 +847,-0.942494306447 +33,0.999911860107 +491,0.790451671234 +445,-0.893983156305 +935,-0.930072731105 +526,-0.976597351709 +261,-0.245281209082 +862,0.933342168368 +440,0.176105293266 +474,0.371376113102 +53,0.395925150182 +605,0.970520754664 +427,-0.253794205503 +557,-0.806436232223 +135,0.088368686104 +258,0.379635626829 +973,-0.77940941514 +630,0.993881997013 +139,0.696080131225 +429,0.985141083712 +552,-0.795787588589 +751,-0.158682193925 +705,0.958941374547 +542,0.997168757104 +986,-0.444031641497 +287,-0.897940948108 +358,-0.141090165312 +149,-0.974648648094 +844,0.885896851207 +363,-0.989353860169 +848,-0.227993559054 +998,-0.85547315197 +609,-0.451972008537 +583,-0.972616056845 +508,-0.806382753952 +103,0.622988631442 +8,0.989358246623 +419,-0.920037850062 +135,0.088368686104 +796,-0.923481578009 +111,-0.864551448611 +872,-0.978437900469 +226,-0.193443817159 +834,-0.995692578437 +255,-0.506391634924 +673,0.643584278011 +303,0.986632504844 +242,-0.0972119075182 +470,-0.945425512269 +252,0.623012211004 +12,-0.536572918 +407,-0.986622678341 +728,-0.750947435767 +656,0.558739049819 +881,0.976603834587 +769,0.636691518553 +405,0.262345765308 +702,-0.989367016834 +510,0.873326667542 +958,0.18469286804 +779,-0.114724923353 +223,0.0530534852699 +218,-0.942524527329 +59,0.636738007139 +852,-0.58784378026 +622,-0.0353380517466 +825,0.945415689655 +655,0.999756505535 +228,0.972623062486 +240,0.945445154921 +403,0.768273957712 +188,-0.475523669012 +42,-0.916521547916 +501,-0.996471703572 +49,-0.953752652759 +671,-0.963779308975 +610,0.506417628279 +935,-0.930072731105 +713,0.141060322436 +427,-0.253794205503 +719,0.412063553628 +154,-0.0619203372561 +290,0.826845633922 +322,0.999912259872 +431,-0.566132485576 +369,-0.9906114771 +437,-0.313257409711 +835,-0.61599296778 +61,-0.966117770008 +6,-0.279415498199 +706,0.756763086604 +151,0.202149881416 +884,-0.936483119966 +290,0.826845633922 +715,-0.958907171294 +553,0.0796086403815 +422,0.855535586422 +27,0.956375928405 +897,-0.99716648991 +165,0.99779727945 +461,0.727121806057 +171,0.976590867944 +719,0.412063553628 +97,0.379607739028 +591,0.371460077098 +102,0.994826791358 +432,-0.999519224404 +452,-0.379579850881 +819,0.816707818437 +551,-0.939540378573 +723,0.420221744856 +763,0.395869787381 +235,0.58058664099 +546,-0.594884318359 +525,-0.346677730585 +382,-0.956367121635 +628,-0.313171527024 +400,-0.850919359639 +152,0.933320523749 +402,-0.123543209378 +205,-0.714897507768 +704,0.279473385116 +551,-0.939540378573 +47,0.123573122745 +76,0.566107636898 +354,0.841454697362 +326,-0.663611334201 +151,0.202149881416 +292,0.167325981012 +201,-0.0618902507187 +907,0.795769333535 +593,0.689654284798 +880,0.346706005358 +557,-0.806436232223 +301,-0.558764049589 +919,0.996461576338 +634,-0.566057938 +153,0.806400580775 +487,-0.0531136889739 +450,-0.683283725036 +757,0.123513295899 +913,0.933288050459 +754,0.0177622043332 +671,-0.963779308975 +518,0.354881993716 +516,0.702429241248 +809,-0.999204431621 +765,-0.999753837548 +666,-0.0176416458133 +850,0.980227731734 +200,-0.873297297214 +321,0.529108265482 +249,-0.727163193444 +141,0.363171365373 +338,-0.961389196822 +840,-0.930128092016 +392,0.643515060153 +987,0.514056027644 +370,-0.650264939561 +215,0.980245621957 +100,-0.50636564111 +752,-0.916545660847 +11,-0.999990206551 +78,0.513978455988 +933,0.0529932813731 +860,-0.714834271403 +424,0.11475486862 +80,-0.993888653923 +329,0.762538949168 +547,0.354966539136 +665,-0.850871852004 +271,0.733210818609 +416,0.966125549876 +67,-0.855519978975 +11,-0.999990206551 +858,-0.338390126969 +277,0.514004313674 +493,0.228022909381 +506,-0.202179403335 +494,-0.696101773472 +917,-0.338248293052 +75,-0.387781635409 +398,0.831758008719 +293,-0.739200998751 +841,-0.811568164468 +342,0.420139682239 +22,-0.0088513092904 +698,0.536623791889 +556,0.0618601641251 +180,-0.801152635734 +481,-0.330019281315 +349,-0.279444441784 +202,0.806418406866 +517,0.978444126076 +258,0.379635626829 +699,0.999990471553 +34,0.52908268612 +435,0.993891981024 +967,-0.573307778903 +846,-0.790470135028 +269,-0.923446880243 +939,0.32990545695 +753,-0.831741274054 +288,-0.855504370751 +53,0.395925150182 +117,-0.689697940935 +800,0.893969648197 +315,0.745133264557 +252,0.623012211004 +299,-0.521576721618 +247,0.926807185503 +462,-0.184811369732 +858,-0.338390126969 +310,0.850887688656 +473,0.981946467414 +967,-0.573307778903 +869,0.939499081438 +746,-0.991786566406 +270,-0.176045946471 +817,0.184840994735 +17,-0.96139749188 +710,6.02887066916e-05 +65,0.82682867949 +835,-0.61599296778 +800,0.893969648197 +762,0.986617763744 +900,0.997803274422 +953,-0.890036835409 +101,0.452025787178 +851,0.363115192377 +966,-0.999210431225 +266,0.860054026465 +946,-0.371488064422 +947,-0.981969268581 +812,0.994832914021 +255,-0.506391634924 +962,0.623059368428 +898,-0.475470631996 +821,-0.864581744786 +933,0.0529932813731 +273,0.313200154871 +363,-0.989353860169 +585,0.616087948358 +882,0.708616602137 +640,-0.773852498156 +556,0.0618601641251 +64,0.920026038197 +556,0.0618601641251 +504,0.974655392178 +765,-0.999753837548 +109,0.816742606636 +90,0.893996663601 +9,0.412118485242 +958,0.18469286804 +848,-0.227993559054 +811,0.452079564177 +331,-0.905591148197 +610,0.506417628279 +220,0.0883987124875 +327,0.270934805316 +521,-0.483265173349 +627,-0.968349414889 +936,-0.193384666873 +763,0.395869787381 +416,0.966125549876 +652,-0.992865461064 +563,-0.609091837945 +475,-0.580635726907 +630,0.993881997013 +214,0.363199451376 +529,0.936472547534 +224,-0.811620997365 +814,-0.321679488026 +203,0.933309700167 +394,-0.963803423625 +609,-0.451972008537 +974,0.10607743501 +250,-0.970528019542 +71,0.951054653254 +841,-0.811568164468 +585,0.616087948358 +344,-0.999990339506 +790,-0.993895307221 +647,-0.167296261569 +987,0.514056027644 +968,0.379691401398 +253,0.994823728671 +814,-0.321679488026 +11,-0.999990206551 +613,-0.379663514286 +491,0.790451671234 +319,-0.99177499561 +542,0.997168757104 +124,-0.995686986889 +838,0.720995935398 +265,0.894010170084 +336,0.149847405733 +303,0.986632504844 +796,-0.923481578009 +237,-0.981957869782 +699,0.999990471553 +549,0.702364872321 +500,-0.467771805322 +53,0.395925150182 +35,-0.428182669496 +210,0.467718518343 +782,0.253765048014 +722,-0.536522042161 +316,0.963787348067 +302,0.395952831043 +827,-0.689741594565 +155,-0.873311982775 +805,0.683305734714 +456,-0.452052675883 +579,0.811638606856 +547,0.354966539136 +288,-0.855504370751 +434,0.444139676971 +33,0.999911860107 +807,0.379551962389 +24,-0.905578362007 +643,0.855488761749 +790,-0.993895307221 +265,0.894010170084 +145,0.467745162045 +639,-0.951073282107 +544,-0.483344343168 +331,-0.905591148197 +194,-0.702386329268 +130,-0.930105950187 +252,0.623012211004 +666,-0.0176416458133 +283,0.25385251979 +132,0.0530835871461 +708,-0.909322514128 +628,-0.313171527024 +754,0.0177622043332 +546,-0.594884318359 +263,-0.779447185499 +682,-0.270963822078 +126,0.329990825674 +320,-0.428155428084 +334,0.8366721491 +826,0.236602816898 +75,-0.387781635409 +86,-0.923458447004 +655,0.999756505535 +754,0.0177622043332 +699,0.999990471553 +181,-0.936451400118 +254,0.451998898063 +370,-0.650264939561 +823,-0.0971219023783 +442,0.821800661502 +776,-0.026611421428 +651,-0.636784493411 +327,0.270934805316 +884,-0.936483119966 +40,0.745113160479 +461,0.727121806057 +71,0.951054653254 +95,0.683261714736 +190,0.997799278681 +828,-0.981940764891 +296,0.636761250565 +305,-0.262403941862 +513,-0.795842349412 +693,0.961380900891 +776,-0.026611421428 +95,0.683261714736 +52,0.98662759204 +578,-0.0530233833456 +189,0.483317953668 +181,-0.936451400118 +172,0.708659140182 +59,0.636738007139 +417,0.739160393875 +616,0.245310432473 +516,0.702429241248 +498,0.998343627044 +657,-0.395980511544 +167,-0.475550186872 +40,0.745113160479 +859,-0.974662135376 +754,0.0177622043332 +113,-0.0971819058932 +424,0.11475486862 +621,-0.860038646335 +82,0.313228782433 +239,0.236690681275 +110,-0.0442426780851 +938,0.972609050321 +994,0.951082595236 +74,-0.985146260468 +319,-0.99177499561 +152,0.933320523749 +93,-0.94828214127 +253,0.994823728671 +999,-0.0264607527371 +598,0.890023092537 +708,-0.909322514128 +287,-0.897940948108 +615,-0.683217692275 +738,0.270847753553 +80,-0.993888653923 +221,0.885938797879 +599,0.864521149292 +752,-0.916545660847 +66,-0.026551154024 +421,0.0265812877381 +559,-0.202090837026 +841,-0.811568164468 +477,-0.498687025536 +476,-0.998813757337 +718,0.989349472816 +808,-0.573431264777 +546,-0.594884318359 +483,-0.721016823278 +518,0.354881993716 +240,0.945445154921 +937,0.721100368243 +113,-0.0971819058932 +608,-0.99482066508 +752,-0.916545660847 +306,-0.953761713494 +997,-0.897967480498 +305,-0.262403941862 +78,0.513978455988 +806,0.983576865728 +577,-0.868935919429 +253,0.994823728671 +452,-0.379579850881 +134,0.88592481646 +594,-0.236719968971 +10,-0.544021110889 +53,0.395925150182 +892,-0.210722131299 +39,0.963795386284 +549,0.702364872321 +503,0.3383617608 +884,-0.936483119966 +192,-0.354938357652 +204,0.202120359313 +765,-0.999753837548 +645,-0.826862587603 +405,0.262345765308 +999,-0.0264607527371 +880,0.346706005358 +729,0.149936817113 +526,-0.976597351709 +102,0.994826791358 +146,0.996469173122 +618,0.779428300674 +950,0.945464794136 +737,0.956358313995 +219,-0.790414741493 +734,-0.905552787157 +496,-0.36314327904 +533,-0.877560883034 +638,-0.253881676588 +35,-0.428182669496 +455,0.506339646835 +166,0.483291563728 +753,-0.831741274054 +619,-0.106047460687 +501,-0.996471703572 +207,-0.338305027541 +155,-0.873311982775 +280,-0.387809420829 +14,0.990607355695 +833,-0.459957024351 +360,0.958915723414 +429,0.985141083712 +592,0.981963569628 +41,-0.158622668805 +758,-0.768293253402 +958,0.18469286804 +598,0.890023092537 +374,-0.149907013456 +646,-0.920002411959 +720,-0.544071696438 +560,0.714918585257 +751,-0.158682193925 +137,-0.942514454558 +618,0.779428300674 +39,0.963795386284 +774,0.92004966109 +543,0.47549715072 +825,0.945415689655 +314,-0.158592906029 +717,0.657032049317 +209,0.996466641766 +308,0.123603036 +328,0.956384734305 +806,0.983576865728 +817,0.184840994735 +871,-0.70245069628 +368,-0.420194391032 +971,-0.245339655642 +61,-0.966117770008 +661,0.953770773362 +56,-0.521551002087 +965,-0.506443621173 +836,0.330047736657 +578,-0.0530233833456 +558,-0.933298875737 +964,0.4519451186 +926,0.696015200688 +665,-0.850871852004 +678,-0.551376385992 +976,0.860023265424 +930,0.0884587650136 +699,0.999990471553 +462,-0.184811369732 +469,-0.784999063373 +858,-0.338390126969 +153,0.806400580775 +92,-0.779466069616 +344,-0.999990339506 +214,0.363199451376 +117,-0.689697940935 +498,0.998343627044 +515,-0.219395848565 +180,-0.801152635734 +877,-0.475603221295 +620,-0.894023675755 +231,-0.995684189758 +683,-0.956393539337 +658,-0.986637416751 +506,-0.202179403335 +329,0.762538949168 +439,-0.733169820872 +238,-0.68967611318 +197,0.79580584292 +259,0.983593183947 +203,0.933309700167 +101,0.452025787178 +697,-0.42011232727 +653,-0.436110502648 +540,-0.346592904377 +903,-0.978469019612 +240,0.945445154921 +524,0.601975797253 +740,-0.988022322677 +594,-0.236719968971 +990,-0.387864990612 +281,-0.985151436329 +393,-0.296397368652 +703,-0.656941145733 +852,-0.58784378026 +295,-0.30478191109 +210,0.467718518343 +69,-0.114784813783 +598,0.890023092537 +816,-0.727101111373 +145,0.467745162045 +843,0.868995589841 +756,0.901762290561 +806,0.983576865728 +200,-0.873297297214 +305,-0.262403941862 +52,0.98662759204 +527,-0.708637871481 +964,0.4519451186 +418,-0.167385419442 +294,-0.966109989263 +825,0.945415689655 +963,0.994817600584 +634,-0.566057938 +853,-0.998341892307 +501,-0.996471703572 +725,0.650242038374 +319,-0.99177499561 +630,0.993881997013 +794,0.733149321004 +791,-0.629841167736 +746,-0.991786566406 +611,0.99920923312 +528,0.210839999735 +963,0.994817600584 +87,-0.821817836631 +864,-0.0619805101619 +202,0.806418406866 +423,0.897914412455 +106,-0.727142500081 +948,-0.68963245579 +947,-0.981969268581 +670,-0.745153367958 +874,0.594981235525 +275,-0.99388532592 +725,0.650242038374 +355,-3.01443533595e-05 +501,-0.996471703572 +12,-0.536572918 +220,0.0883987124875 +66,-0.026551154024 +949,0.236749256451 +584,-0.329933913491 +835,-0.61599296778 +410,0.999754505908 +34,0.52908268612 +605,0.970520754664 +672,-0.296310998016 +854,-0.490969072656 +366,0.999990072687 +922,-0.998350556921 +658,-0.986637416751 +947,-0.981969268581 +692,0.751027055047 +68,-0.897927680689 +654,0.521602440676 +123,-0.45990349069 +57,0.436164755248 +765,-0.999753837548 +188,-0.475523669012 +923,-0.587721843522 +86,-0.923458447004 +152,0.933320523749 +663,-0.123632949143 +779,-0.114724923353 +880,0.346706005358 +827,-0.689741594565 +552,-0.795787588589 +262,-0.948291709522 +829,-0.371348124428 +582,-0.721079482984 +205,-0.714897507768 +610,0.506417628279 +943,0.498791536257 +475,-0.580635726907 +343,-0.536598355189 +564,-0.996464109505 +249,-0.727163193444 +671,-0.963779308975 +5,-0.958924274663 +144,-0.491021593898 +949,0.236749256451 +163,-0.354910175845 +577,-0.868935919429 +24,-0.905578362007 +680,0.988040921918 +588,-0.498765409257 +749,0.96381146009 +718,0.989349472816 +290,0.826845633922 +76,0.566107636898 +223,0.0530534852699 +5,-0.958924274663 +867,-0.0794884450788 +882,0.708616602137 +762,0.986617763744 +859,-0.974662135376 +167,-0.475550186872 +883,-0.210869466365 +819,0.816707818437 +40,0.745113160479 +292,0.167325981012 +792,0.313286036704 +216,0.696058488345 +437,-0.313257409711 +893,0.708722942421 +902,-0.354994720298 +468,0.0971519041799 +228,0.972623062486 +429,0.985141083712 +44,0.0177019251054 +323,0.551401533867 +60,-0.304810621102 +622,-0.0353380517466 +544,-0.483344343168 +182,-0.2107810659 +511,0.881770400761 +774,0.92004966109 +471,-0.236632105238 +39,0.963795386284 +841,-0.811568164468 +977,0.0353079262048 +311,0.0176717854674 +338,-0.961389196822 +858,-0.338390126969 +193,-0.978456574622 +894,0.976571411323 +884,-0.936483119966 +623,0.821852184648 +378,0.846236465698 +124,-0.995686986889 +49,-0.953752652759 +994,0.951082595236 +912,0.806454056848 +687,0.846188278824 +276,-0.444085660041 +900,0.997803274422 +197,0.79580584292 +749,0.96381146009 +130,-0.930105950187 +642,0.897954214711 +471,-0.236632105238 +726,-0.287961052193 +207,-0.338305027541 +132,0.0530835871461 +519,-0.594957007044 +553,0.0796086403815 +219,-0.790414741493 +316,0.963787348067 +290,0.826845633922 +303,0.986632504844 +168,-0.997173288774 +362,-0.657009324316 +511,0.881770400761 +338,-0.961389196822 +355,-3.01443533595e-05 +172,0.708659140182 +478,0.459930257729 +448,0.948272572156 +2,0.909297426826 +851,0.363115192377 +861,0.20220892507 +806,0.983576865728 +973,-0.77940941514 +120,0.580611184212 +665,-0.850871852004 +786,0.566157333739 +629,0.629934818523 +303,0.986632504844 +485,0.930117021524 +971,-0.245339655642 +212,-0.998347093797 +103,0.622988631442 +314,-0.158592906029 +7,0.656986598719 +675,0.428128186284 +673,0.643584278011 +991,-0.985161785365 +163,-0.354910175845 +843,0.868995589841 +456,-0.452052675883 +973,-0.77940941514 +148,-0.338333394324 +754,0.0177622043332 +355,-3.01443533595e-05 +431,-0.566132485576 +236,-0.371432089437 +945,0.580537552962 +650,0.304753200801 +707,-0.141179693171 +728,-0.750947435767 +603,-0.184722493715 +166,0.483291563728 +122,0.498713153896 +532,-0.877604238953 +303,0.986632504844 +425,-0.773909772204 +501,-0.996471703572 +51,0.670229175843 +644,0.0264908865234 +320,-0.428155428084 +198,-0.0795785916643 +794,0.733149321004 +281,-0.985151436329 +333,-0.00882116611389 +234,0.998816691203 +747,-0.643491986364 +782,0.253765048014 +746,-0.991786566406 +221,0.885938797879 +7,0.656986598719 +326,-0.663611334201 +647,-0.167296261569 +178,0.877575335804 +634,-0.566057938 +869,0.939499081438 +627,-0.968349414889 +813,0.622941470621 +409,0.558814047606 +328,0.956384734305 +470,-0.945425512269 +827,-0.689741594565 +57,0.436164755248 +882,0.708616602137 +457,-0.994829853142 +798,0.0354585535921 +115,0.945435334025 +817,0.184840994735 +786,0.566157333739 +643,0.855488761749 +429,0.985141083712 +321,0.529108265482 +453,0.573406568644 +725,0.650242038374 +502,-0.609020113022 +284,0.951063968113 +682,-0.270963822078 From 93318472807c9510b46c75e34ca381f246ad1cd6 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 13 Sep 2015 23:38:05 -0400 Subject: [PATCH 4/4] got rid of optparse --- bashplotlib/cli/scatter.py | 61 +- bashplotlib/cli/scatter2.py | 93 -- bashplotlib/core/helpers.py | 110 ++ bashplotlib/core/histogram.py | 19 +- bashplotlib/core/scatterplot.py | 108 +- bashplotlib/utils/__init__.py | 4 - bashplotlib/utils/helpers.py | 57 - bin/hist | 1 - bin/scatter | 43 +- data/xydata-headers.csv | 1999 +++++++++++++++---------------- data/xydata.csv | 1 - 11 files changed, 1231 insertions(+), 1265 deletions(-) delete mode 100644 bashplotlib/cli/scatter2.py create mode 100644 bashplotlib/core/helpers.py delete mode 100644 bashplotlib/utils/__init__.py delete mode 100644 bashplotlib/utils/helpers.py diff --git a/bashplotlib/cli/scatter.py b/bashplotlib/cli/scatter.py index c229289..37351f2 100644 --- a/bashplotlib/cli/scatter.py +++ b/bashplotlib/cli/scatter.py @@ -1,20 +1,53 @@ -scatter = { - "usage": """scatterplot is a command for making xy plots. it accepts a series of x values and a series of y values in the - following formats: - 1) a txt file or standard in value w/ 2 comma seperated columns of x,y values - 2) 2 txt files. 1 w/ designated x values and another with designated y values. - - scatter -x -y - cat | scatter +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""scatter - """ -} +Usage: + scatter ((FILE | -f FILENAME) | (-X XDATA -y YDATA)) [-t TITLE -s SIZE -p MARKERSHAPE -c COLOUR] [-h -H] +Arguments: + FILE Csv with 2 columns for x and y [default: ] + -f --file FILENAME Same as FILE but shorter and less explicit [default: ] + -X --xs-file XDATA Text file with 1 column for the X values [default: ] + -y --ys-file YDATA Text file with 1 column for the y values [default: ] + -t --title TITLE Title for the chart [default: ] + -s --size SIZE Height of the histogram in lines [default: 20.0] + -p --pch MARKERSHAPE Shape of each bar [default: x] + -c --colour COLOUR Colour of the plot (Pink, blue, green, red, white, aqua, grey, yellow) [default: white] + -H --skip-header Skip the first row in FILENAME, XDATA, and YDATA [default: False] -# SCATTER_DOCSTRING = """scatter - construct a scatter plot from your terminal +Options: + -h --help Show this screen -# Usage: -# scatter [X Y] +Examples: + $ scatter2 -X data/exp.txt -y data/exp.txt +""" +from docopt import docopt +from bashplotlib.cli.helpers import read_stdin_or_timeout -# """ +def parse_args(): + """takes __doc__ for given cmd. Returns parsed args using docopt. + """ + args = docopt(__doc__) + for k, v in args.iteritems(): + if v == 'None': + args[k] = None + if args['--file'] is None and (args['--xs-file'] is None or args['--ys-file'] is None): + print __doc__ + sys.exit(1) + if args['FILE'] is not None or args['--file'] is not None: + if args['FILE'] and args['FILE'] != args['--file']: + args['--file'] = args['FILE'] + if args['--file'] == 'stdin': + args['--file'] = read_stdin_or_timeout() + plot_params = { + 'filename': args['--file'], + 'xs': args['--xs-file'], + 'ys': args['--ys-file'], + 'size': float(args['--size']), + 'pch': args['--pch'], + 'colour': args['--colour'], + 'title': args['--title'], + } + return {k: v for k,v in plot_params.items() if v is not None and v != ""} diff --git a/bashplotlib/cli/scatter2.py b/bashplotlib/cli/scatter2.py deleted file mode 100644 index 3452abd..0000000 --- a/bashplotlib/cli/scatter2.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -"""scatter2 - -Usage: - scatter2 [[FILE|-f FILENAME] -t TITLE -b BINS -s SIZE -p MARKERSHAPE -x XLAB -c COLOUR] [-n] [-h] - -Arguments: - FILE Csv with 2 columns for x and y [default: ] - -f --file FILENAME Same as FILE but shorter and less explicit [default: ] - -t --title TITLE Title for the chart [default: ] - -X --X-vals X X values - -y --y-vals y y values - -s --size SIZE Height of the histogram in lines [default: 20.0] - -p --pch MARKERSHAPE Shape of each bar [default: x] - -c --colour COLOUR Colour of the plot (Pink, blue, green, red, white, aqua, grey, yellow) [default: white] - -Options: - -n --nosummary Hide summary - -h --help Show this screen - -Examples: - $ hist test.csv -t "you're the man now dog" - $ hist -f test.csv -t "you're the man now dog" - $ hist --file test.csv -t "you're the man now dog" - $ cat test.csv | hist -t "you're the man now dog" - -""" -from docopt import docopt -from bashplotlib.cli.helpers import read_stdin_or_timeout -from bashplotlib.utils.helpers import try_cast_str_to_number - -def _read_csv(filename, X=0, y=1, sep=',', header=False): - X_y_pairs = [] - with open(filename, 'r') as f: - data = [line.strip() for line in f.readlines()] - if not data: - return None - else: - if isinstance(X, int) and isinstance(y, int): - X_idx, y_idx = X, y - elif isinstance(X, basestring) and isinstance(y, basestring): - if X.strip().isdigit() and y.strip().isdigit(): - X_idx, y_idx = map(try_cast_str_to_number, [X_idx, y_idx]) - else: - X_idx, y_idx = None, None - for i, line in enumerate(data): - row = [item.strip() for item in line.strip().split(sep)] - if i == 0: - if header: - for j, col in enumerate(row): - if col.lower() == X.lower(): - X_idx = j - if col.lower() == y.lower(): - y_idx = j - if X_idx and y_idx: - continue - if row and isinstance(row, list) and len(row): - try: - X_value, y_value = row[X_idx], row[y_idx] - X_value, y_value = map(try_cast_str_to_number, [X_value, y_value]) - X_y_pairs.append([X_value, y_value]) - except Exception, err: - continue - return X_y_pairs - - -# # plot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t) -# def parse_args(): -# """takes __doc__ for given cmd. Returns parsed args using docopt. -# """ -# args = docopt() -# for k, v in args.iteritems(): -# if v == 'None': -# args[k] = None -# if args['FILE'] and args['FILE'] != args['--file']: -# args['--file'] = args['FILE'] -# if args['--file'] == 'stdin': -# args['--file'] = read_stdin_or_timeout() -# if args['--file'] is None: -# print -# sys.exit(1) -# plot_params = { -# 'bincount': args['--bins'], -# 'colour': args['--colour'], -# 'data': args['--file'], -# 'height': float(args['--height'].strip()), -# 'pch': args['--pch'], -# 'showSummary': (not args['--nosummary']), -# 'title': args['--title'], -# 'xlab': args['--xlab'] -# } -# return plot_params diff --git a/bashplotlib/core/helpers.py b/bashplotlib/core/helpers.py new file mode 100644 index 0000000..846e39e --- /dev/null +++ b/bashplotlib/core/helpers.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""core/helpers.py +""" +import os +import sys +import collections + +bcolours = { + "white": '\033[97m', + "aqua": '\033[96m', + "pink": '\033[95m', + "blue": '\033[94m', + "yellow": '\033[93m', + "green": '\033[92m', + "red": '\033[91m', + "grey": '\033[90m', + "ENDC": '\033[0m' +} + +def isiterable(obj): + """ + Return True if you can loop over obj otherwise False + """ + return isinstance(obj, collections.Iterable) + +def get_colour(colour): + return bcolours.get(colour, bcolours['white']) + +def printcolour(text, sameline=False, colour=get_colour("ENDC")): + """ + Print color text using escape codes + """ + if sameline: + sep = '' + else: + sep = '\n' + sys.stdout.write(get_colour(colour) + text + bcolours["ENDC"] + sep) + +printcolor = printcolour + +def drange(start, stop, step=1.0): + "generate between 2 numbers w/ optional step" + if step==0: + step = 0.01 + r = start + while r < stop: + yield r + r += step + +def box_text(text, width, offset=0): + box = " "*offset + "-"*(width+2) + "\n" + box += " "*offset + "|"+ text.center(width) + "|" + "\n" + box += " "*offset + "-"*(width+2) + return box + +def try_cast_str_to_number(number_str, verbose=False): + "takes txt and tries to coerce it to float" + try: + return float(number_str.strip()) + except Exception, err: + if verbose: + sys.stderr.write(err.message) + sys.stderr.flush() + return None + +def read_xy_pairs_from_csv(filename, X=0, y=1, sep=',', header=False): + """Grab 2 columns from a csv file by name or col index + + Arguments: + filename Name of the csv file to read + X Index of the X column in the file [default: 0] + y Index of the y column in the file [default: 0] + sep Delimiter of the file [default: ,] + header Does the file have headers in row #1 [default: False] + + """ + with open(filename, 'r') as f: + data = [line.strip() for line in f.readlines()] + data = [line.split(sep) for line in data] + data = [map(str.strip, row) for row in data] + + if isinstance(X, int) and isinstance(y, int): + X_idx, y_idx = X, y + elif isinstance(X, basestring) and isinstance(y, basestring) \ + and X.strip().isdigit() and y.strip().isdigit(): + X_idx = int(try_cast_str_to_number(X)) + y_idx = int(try_cast_str_to_number(y)) + else: + X_idx, y_idx = None, None + X_y_pairs = [] + for i, row in enumerate(data): + if i == 0 and header: + for j, col in enumerate(row): + if col.strip().lower() == X.strip().lower(): + X_idx = j + if col.strip().lower() == y.strip().lower(): + y_idx = j + if (X_idx is None or y_idx is None): + raise Exception("Column not found.") + try: + row = [try_cast_str_to_number(item) for item in row] + if row[0] and row[1]: + X_y_pairs.append(row) + except Exception, err: + pass + return X_y_pairs + + + diff --git a/bashplotlib/core/histogram.py b/bashplotlib/core/histogram.py index 4ff908a..a102c2d 100644 --- a/bashplotlib/core/histogram.py +++ b/bashplotlib/core/histogram.py @@ -1,8 +1,11 @@ -#!/usr/bin/python +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""histogram.py +""" import math -import sys, os -from bashplotlib.utils import helpers -import collections +import sys +import os +from bashplotlib.core import helpers def calc_bins(n, min_val, max_val, h=None): "calculate number of bins for the histogram" @@ -23,13 +26,12 @@ def read_numbers(numbers): numbers = [line for line in open(numbers, 'r') if line.strip()] except Exception, err: pass - if isinstance(numbers, collections.Iterable): + if helpers.isiterable(numbers): for number in numbers: number = helpers.try_cast_str_to_number(number) if number: yield number - def plot_hist(data, height=20.0, bincount=None, pch="o", colour="white", title="", xlab=None, showSummary=False): """make a histogram for continuous variable. @@ -57,7 +59,6 @@ def plot_hist(data, height=20.0, bincount=None, pch="o", colour="white", title=" max_val = number mean += number mean /= n - bins = list(calc_bins(n, min_val, max_val, bincount)) hist = {} for i in range(len(bins)): @@ -96,10 +97,7 @@ def plot_hist(data, height=20.0, bincount=None, pch="o", colour="white", title=" helpers.printcolor(" ", True, colour) print xs = hist.keys() * 2 - print " "*(nlen+1) + "-"*len(xs) - - if xlab: for i in range(0, nlen): helpers.printcolor(" "*(nlen+1), True, colour) @@ -112,7 +110,6 @@ def plot_hist(data, height=20.0, bincount=None, pch="o", colour="white", title=" print center = max(map(len, map(str, [n, min_val, mean, max_val]))) center += 15 - if showSummary: print print "-"*(2 + center) diff --git a/bashplotlib/core/scatterplot.py b/bashplotlib/core/scatterplot.py index 558b32d..9271ed7 100644 --- a/bashplotlib/core/scatterplot.py +++ b/bashplotlib/core/scatterplot.py @@ -1,73 +1,79 @@ -#!/usr/bin/python -import csv -import optparse +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""scatterplot.py +""" +from __future__ import print_function import sys -from bashplotlib.utils import helpers -from utils.commandhelp import scatter - +import os +from bashplotlib.core import helpers def get_scale(series, is_y=False, steps=20): - min_val = min(series) - max_val = max(series) - scaled_series = [] - for x in helpers.drange(min_val, max_val, (max_val-min_val)/steps): - if x > 0 and scaled_series and max(scaled_series) < 0: - scaled_series.append(0.0) - scaled_series.append(x) - - if is_y: - scaled_series.reverse() - return scaled_series + try: + min_val = min(series) + max_val = max(series) + scaled_series = [] + for x in helpers.drange(min_val, max_val, (max_val-min_val)/steps): + if x > 0 and scaled_series and max(scaled_series) < 0: + scaled_series.append(0.0) + scaled_series.append(x) + if is_y: + scaled_series.reverse() + return scaled_series + except Exception, err: + print(err) + # print(series) + print(is_y) + print(steps) -def plot_scatter(f, xs, ys, size, pch, colour, title): - """Form a complex number. +def plot_scatter(filename=None, xs=None, ys=None, size=20, pch='x', colour='white', title=None, skipheader=False): + """plot (X,y) pairs from columns in a file or 2 separate files Arguments: - f -- comma delimited file w/ x,y coordinates - xs -- if f not specified this is a file w/ x coordinates - ys -- if f not specified this is a filew / y coordinates - size -- size of the plot - pch -- shape of the points (any character) - colour -- colour of the points - title -- title of the plot + xs List of values to use on X axis [default: None] + ys List of values to use on y axis [default: None] + filename Name of a csv file [default: None] + skipheader Skip the first row [default: False] + size Marketsize [default: 20] + pch Markershape [default: x] + colour Marker colour [default: white] + title Title [default: ] + """ - - if f: - if isinstance(f, str): - f = open(f) - - data = [tuple(map(float, line.strip().split(','))) for line in f] + + if filename: + data = helpers.read_xy_pairs_from_csv(filename, X=0, y=1, header=skipheader) xs = [i[0] for i in data] ys = [i[1] for i in data] else: - xs = [float(str(row).strip()) for row in open(xs)] - ys = [float(str(row).strip()) for row in open(ys)] - - colour = helpers.get_colour(colour) - + xs = [line.strip() for line in open(xs, 'r').readlines()] + ys = [line.strip() for line in open(ys, 'r').readlines()] + if skipheader: + xs = xs[1:] + ys = ys[1:] + xs = map(float, xs) + ys = map(float, ys) + if (xs is None or ys is None): + raise Exception("Missing `xs` or `ys` data.") plotted = set() - if title: - print helpers.box_text(title, 2*len(get_scale(xs, False, size))+1) - - print "-"*(2*len(get_scale(xs, False, size))+2) + print(helpers.box_text(title, 2 * len(get_scale(xs, False, size)) + 1)) + + print("-" * (2 * len(get_scale(xs, False, size)) + 2)) for y in get_scale(ys, True, size): - print "|", + print("|", end=' ') for x in get_scale(xs, False, size): point = " " for (i, (xp, yp)) in enumerate(zip(xs, ys)): if xp <= x and yp >= y and (xp, yp) not in plotted: point = pch - #point = str(i) + #point = str(i) plotted.add((xp, yp)) - if x==0 and y==0: + if x == 0 and y == 0: point = "o" - elif x==0: + elif x == 0: point = "|" - elif y==0: + elif y == 0: point = "-" - printcolor(point, True, colour) - print "|" - print "-"*(2*len(get_scale(xs, False, size))+2) - - + helpers.printcolour(point, True, colour) + print("|") + print("-" * (2 * len(get_scale(xs, False, size)) + 2)) diff --git a/bashplotlib/utils/__init__.py b/bashplotlib/utils/__init__.py deleted file mode 100644 index a079ae6..0000000 --- a/bashplotlib/utils/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -"""utils/__init__.py -""" diff --git a/bashplotlib/utils/helpers.py b/bashplotlib/utils/helpers.py deleted file mode 100644 index 9a86400..0000000 --- a/bashplotlib/utils/helpers.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -"""utils/helpers.py -""" -import os, sys - -bcolours = { - "white": '\033[97m', - "aqua": '\033[96m', - "pink": '\033[95m', - "blue": '\033[94m', - "yellow": '\033[93m', - "green": '\033[92m', - "red": '\033[91m', - "grey": '\033[90m', - "ENDC": '\033[0m' -} - -def get_colour(colour): - return bcolours.get(colour, bcolours['white']) - -def printcolor(txt, sameline=False, color=get_colour("white")): - if sameline: - if color=='\033[97m': - print txt, - else: - print color + txt + bcolours["ENDC"], - else: - if color=='\033[97m': - print txt - else: - print color + txt + bcolours["ENDC"] - -def drange(start, stop, step=1.0): - "generate between 2 numbers w/ optional step" - if step==0: - step = 0.01 - r = start - while r < stop: - yield r - r += step - -def box_text(text, width, offset=0): - box = " "*offset + "-"*(width+2) + "\n" - box += " "*offset + "|"+ text.center(width) + "|" + "\n" - box += " "*offset + "-"*(width+2) - return box - -def try_cast_str_to_number(number_str, verbose=False): - "takes txt and tries to coerce it to float" - try: - return float(number_str.strip()) - except Exception, err: - if verbose: - sys.stderr.write(err.message) - sys.stderr.flush() - return None diff --git a/bin/hist b/bin/hist index a93e149..753b31d 100755 --- a/bin/hist +++ b/bin/hist @@ -5,7 +5,6 @@ from bashplotlib.cli.hist import __doc__ from bashplotlib.cli.hist import parse_args from bashplotlib.core.histogram import plot_hist - def main(): plot_params = parse_args() plot_hist(**plot_params) diff --git a/bin/scatter b/bin/scatter index 03ff87f..99b09d1 100755 --- a/bin/scatter +++ b/bin/scatter @@ -1,37 +1,14 @@ #!/usr/bin/env python -import csv -import optparse +# -*- coding: utf-8 -*- +import os import sys -from bashplotlib.utils.helpers import * -from bashplotlib.utils.commandhelp import scatter -from bashplotlib.scatterplot import plot_scatter +from bashplotlib.cli.scatter import __doc__ +from bashplotlib.cli.scatter import parse_args +from bashplotlib.core.scatterplot import plot_scatter +def main(): + plot_params = parse_args() + plot_scatter(**plot_params) -if __name__=='__main__': - - parser = optparse.OptionParser(usage=scatter['usage']) - parser.add_option('-f', '--file', help='a csv w/ x and y coordinates', - default=None, dest='f') - parser.add_option('-t', '--title', help='title for the chart', - default='', dest='t') - parser.add_option('-x', help='x coordinates', - default=None, dest='x') - parser.add_option('-y', help='y coordinates', - default=None, dest='y') - parser.add_option('-s', '--size',help='y coordinates', - default=20, dest='size', type='int') - parser.add_option('-p', '--pch',help='shape of point', - default='x', dest='pch') - parser.add_option('-c', '--colour', help='colour of the plot (%s)' % ', '.join(bcolours.keys()), - default='white', dest='colour') - - (opts, args) = parser.parse_args() - - if opts.f is None and (opts.x is None or opts.y is None): - opts.f = sys.stdin.readlines() - - if opts.f or (opts.x and opts.y): - plot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t) - else: - print "nothing to plot!" - +if __name__ == "__main__": + main() diff --git a/data/xydata-headers.csv b/data/xydata-headers.csv index 726cb65..89a85f8 100644 --- a/data/xydata-headers.csv +++ b/data/xydata-headers.csv @@ -1,1001 +1,1000 @@ X,y -609,-0.451972008537 -153,0.806400580775 -276,-0.444085660041 -63,0.167355700303 -565,-0.467691874215 -76,0.566107636898 -609,-0.451972008537 -525,-0.346677730585 -834,-0.995692578437 -169,-0.601999867678 -375,-0.912957551683 -526,-0.976597351709 -78,0.513978455988 -270,-0.176045946471 -309,0.901801374964 -56,-0.521551002087 -358,-0.141090165312 -110,-0.0442426780851 -879,-0.601951726281 -303,0.986632504844 -282,-0.676749764526 -305,-0.262403941862 -274,-0.629911406685 -320,-0.428155428084 -891,-0.936430249298 -307,-0.768235364237 -235,0.58058664099 -150,-0.714876429629 -686,0.905603933565 -747,-0.643491986364 -256,-0.999208034107 -716,-0.279357610266 -731,0.836622615127 -33,0.999911860107 -864,-0.0619805101619 -589,-0.998818156774 -894,0.976571411323 -461,0.727121806057 -834,-0.995692578437 -585,0.616087948358 -319,-0.99177499561 -56,-0.521551002087 -703,-0.656941145733 -522,0.4755767043 -421,0.0265812877381 -743,0.999911057852 -468,0.0971519041799 -164,0.594932778023 -526,-0.976597351709 -341,0.99060323339 -629,0.629934818523 -983,0.313142898892 -352,0.141149850679 -561,0.974635157271 -30,-0.988031624093 -981,0.733251813681 -144,-0.491021593898 -567,0.998348825812 -29,-0.663633884213 -321,0.529108265482 -556,0.0618601641251 -938,0.972609050321 -975,0.894037180613 -513,-0.795842349412 -546,-0.594884318359 -831,0.998812289042 -862,0.933342168368 -210,0.467718518343 -617,0.948301276912 -605,0.970520754664 -812,0.994832914021 -811,0.452079564177 -789,-0.44416668483 -368,-0.420194391032 -600,0.0441824483319 -593,0.689654284798 -395,-0.745093055724 -138,-0.228052259501 -285,0.773871590208 -228,0.972623062486 -200,-0.873297297214 -293,-0.739200998751 -226,-0.193443817159 -799,0.860100162164 -738,0.270847753553 -938,0.972609050321 -389,-0.529057106277 -399,-0.0177320647274 -584,-0.329933913491 -941,-0.995678592782 -890,-0.801188714661 -138,-0.228052259501 -635,0.387837205897 -924,0.363255622392 -822,-0.889968112962 -494,-0.696101773472 -629,0.629934818523 -348,0.656963872524 -900,0.997803274422 -76,0.566107636898 -387,-0.551451828115 -721,-0.999989937914 -233,0.498739281803 -639,-0.951073282107 -438,-0.968371982886 -807,0.379551962389 -982,0.968341890464 -841,-0.811568164468 -55,-0.999755173359 -744,0.529031525954 -556,0.0618601641251 -862,0.933342168368 -706,0.756763086604 -739,-0.663678982428 -26,0.76255845048 -315,0.745133264557 -304,0.670206803781 -169,-0.601999867678 -397,0.916533604798 -861,0.20220892507 -809,-0.999204431621 -740,-0.988022322677 -737,0.956358313995 -561,0.974635157271 -814,-0.321679488026 -978,-0.821869357536 -322,0.999912259872 -212,-0.998347093797 -18,-0.750987246772 -410,0.999754505908 -426,-0.951045337532 -570,-0.980251583583 -737,0.956358313995 -503,0.3383617608 -929,-0.790377808879 -479,0.995689783115 -931,0.885966758301 -595,-0.945454974958 -389,-0.529057106277 -85,-0.176075619949 -480,0.616016713764 -386,0.404010070823 -278,0.999521091849 -840,-0.930128092016 -480,0.616016713764 -36,-0.991778853443 -754,0.0177622043332 -480,0.616016713764 -661,0.953770773362 -554,0.881813052519 -167,-0.475550186872 -109,0.816742606636 -763,0.395869787381 -503,0.3383617608 -119,-0.371404101438 -430,0.387753849637 -441,0.923470012926 -803,-0.948263002181 -906,0.939550700722 -490,-0.0883386596402 -545,-0.997801277005 -145,0.467745162045 -224,-0.811620997365 -353,0.90930997089 -197,0.79580584292 -590,-0.580562097239 -669,0.158563143108 -105,-0.970535283537 -27,0.956375928405 -750,0.745072950292 -859,-0.974662135376 -253,0.994823728671 -122,0.498713153896 -95,0.683261714736 -969,0.98360405829 -844,0.885896851207 -727,-0.961414079374 -97,0.379607739028 -687,0.846188278824 -797,-0.821783485626 -793,0.968379503791 -33,0.999911860107 -39,0.963795386284 -497,0.587819393981 -185,0.346621180094 -311,0.0176717854674 -122,0.498713153896 -824,0.785017737351 -544,-0.483344343168 -755,0.850935193971 -392,0.643515060153 -301,-0.558764049589 -864,-0.0619805101619 -580,0.930083804977 -944,0.998819621438 -721,-0.999989937914 -129,-0.193473392038 -127,0.972630067242 -91,0.105987511751 -568,0.587746231938 -622,-0.0353380517466 -397,0.916533604798 -747,-0.643491986364 -360,0.958915723414 -805,0.683305734714 -829,-0.371348124428 -869,0.939499081438 -401,-0.901775319514 -847,-0.942494306447 -33,0.999911860107 -491,0.790451671234 -445,-0.893983156305 -935,-0.930072731105 -526,-0.976597351709 -261,-0.245281209082 -862,0.933342168368 -440,0.176105293266 -474,0.371376113102 -53,0.395925150182 -605,0.970520754664 -427,-0.253794205503 -557,-0.806436232223 -135,0.088368686104 -258,0.379635626829 -973,-0.77940941514 -630,0.993881997013 -139,0.696080131225 -429,0.985141083712 -552,-0.795787588589 -751,-0.158682193925 -705,0.958941374547 -542,0.997168757104 -986,-0.444031641497 -287,-0.897940948108 -358,-0.141090165312 -149,-0.974648648094 -844,0.885896851207 -363,-0.989353860169 -848,-0.227993559054 -998,-0.85547315197 -609,-0.451972008537 -583,-0.972616056845 -508,-0.806382753952 -103,0.622988631442 -8,0.989358246623 -419,-0.920037850062 -135,0.088368686104 -796,-0.923481578009 -111,-0.864551448611 -872,-0.978437900469 -226,-0.193443817159 -834,-0.995692578437 -255,-0.506391634924 -673,0.643584278011 -303,0.986632504844 -242,-0.0972119075182 -470,-0.945425512269 -252,0.623012211004 -12,-0.536572918 -407,-0.986622678341 -728,-0.750947435767 -656,0.558739049819 -881,0.976603834587 -769,0.636691518553 -405,0.262345765308 -702,-0.989367016834 -510,0.873326667542 -958,0.18469286804 -779,-0.114724923353 -223,0.0530534852699 -218,-0.942524527329 -59,0.636738007139 -852,-0.58784378026 -622,-0.0353380517466 -825,0.945415689655 -655,0.999756505535 -228,0.972623062486 -240,0.945445154921 -403,0.768273957712 -188,-0.475523669012 -42,-0.916521547916 -501,-0.996471703572 -49,-0.953752652759 -671,-0.963779308975 -610,0.506417628279 -935,-0.930072731105 -713,0.141060322436 -427,-0.253794205503 -719,0.412063553628 -154,-0.0619203372561 -290,0.826845633922 -322,0.999912259872 -431,-0.566132485576 -369,-0.9906114771 -437,-0.313257409711 -835,-0.61599296778 -61,-0.966117770008 -6,-0.279415498199 -706,0.756763086604 -151,0.202149881416 -884,-0.936483119966 -290,0.826845633922 -715,-0.958907171294 -553,0.0796086403815 -422,0.855535586422 -27,0.956375928405 -897,-0.99716648991 -165,0.99779727945 -461,0.727121806057 -171,0.976590867944 -719,0.412063553628 -97,0.379607739028 -591,0.371460077098 -102,0.994826791358 -432,-0.999519224404 -452,-0.379579850881 -819,0.816707818437 -551,-0.939540378573 -723,0.420221744856 -763,0.395869787381 -235,0.58058664099 -546,-0.594884318359 -525,-0.346677730585 -382,-0.956367121635 -628,-0.313171527024 -400,-0.850919359639 -152,0.933320523749 -402,-0.123543209378 -205,-0.714897507768 -704,0.279473385116 -551,-0.939540378573 -47,0.123573122745 -76,0.566107636898 -354,0.841454697362 -326,-0.663611334201 -151,0.202149881416 -292,0.167325981012 -201,-0.0618902507187 -907,0.795769333535 -593,0.689654284798 -880,0.346706005358 -557,-0.806436232223 -301,-0.558764049589 -919,0.996461576338 -634,-0.566057938 -153,0.806400580775 -487,-0.0531136889739 -450,-0.683283725036 -757,0.123513295899 -913,0.933288050459 -754,0.0177622043332 -671,-0.963779308975 -518,0.354881993716 -516,0.702429241248 -809,-0.999204431621 -765,-0.999753837548 -666,-0.0176416458133 -850,0.980227731734 -200,-0.873297297214 -321,0.529108265482 -249,-0.727163193444 -141,0.363171365373 -338,-0.961389196822 -840,-0.930128092016 -392,0.643515060153 -987,0.514056027644 -370,-0.650264939561 -215,0.980245621957 -100,-0.50636564111 -752,-0.916545660847 -11,-0.999990206551 -78,0.513978455988 -933,0.0529932813731 -860,-0.714834271403 -424,0.11475486862 -80,-0.993888653923 -329,0.762538949168 -547,0.354966539136 -665,-0.850871852004 -271,0.733210818609 -416,0.966125549876 -67,-0.855519978975 -11,-0.999990206551 -858,-0.338390126969 -277,0.514004313674 -493,0.228022909381 -506,-0.202179403335 -494,-0.696101773472 -917,-0.338248293052 -75,-0.387781635409 -398,0.831758008719 -293,-0.739200998751 -841,-0.811568164468 -342,0.420139682239 -22,-0.0088513092904 -698,0.536623791889 -556,0.0618601641251 -180,-0.801152635734 -481,-0.330019281315 -349,-0.279444441784 -202,0.806418406866 -517,0.978444126076 -258,0.379635626829 -699,0.999990471553 -34,0.52908268612 -435,0.993891981024 -967,-0.573307778903 -846,-0.790470135028 -269,-0.923446880243 -939,0.32990545695 -753,-0.831741274054 -288,-0.855504370751 -53,0.395925150182 -117,-0.689697940935 -800,0.893969648197 -315,0.745133264557 -252,0.623012211004 -299,-0.521576721618 -247,0.926807185503 -462,-0.184811369732 -858,-0.338390126969 -310,0.850887688656 -473,0.981946467414 -967,-0.573307778903 -869,0.939499081438 -746,-0.991786566406 -270,-0.176045946471 -817,0.184840994735 -17,-0.96139749188 -710,6.02887066916e-05 -65,0.82682867949 -835,-0.61599296778 -800,0.893969648197 -762,0.986617763744 -900,0.997803274422 -953,-0.890036835409 -101,0.452025787178 -851,0.363115192377 -966,-0.999210431225 -266,0.860054026465 -946,-0.371488064422 -947,-0.981969268581 -812,0.994832914021 -255,-0.506391634924 -962,0.623059368428 -898,-0.475470631996 -821,-0.864581744786 -933,0.0529932813731 -273,0.313200154871 -363,-0.989353860169 -585,0.616087948358 -882,0.708616602137 -640,-0.773852498156 -556,0.0618601641251 -64,0.920026038197 -556,0.0618601641251 -504,0.974655392178 -765,-0.999753837548 -109,0.816742606636 -90,0.893996663601 -9,0.412118485242 -958,0.18469286804 -848,-0.227993559054 -811,0.452079564177 -331,-0.905591148197 -610,0.506417628279 -220,0.0883987124875 -327,0.270934805316 -521,-0.483265173349 -627,-0.968349414889 -936,-0.193384666873 -763,0.395869787381 -416,0.966125549876 -652,-0.992865461064 -563,-0.609091837945 -475,-0.580635726907 -630,0.993881997013 -214,0.363199451376 -529,0.936472547534 -224,-0.811620997365 -814,-0.321679488026 -203,0.933309700167 -394,-0.963803423625 -609,-0.451972008537 -974,0.10607743501 -250,-0.970528019542 -71,0.951054653254 -841,-0.811568164468 -585,0.616087948358 -344,-0.999990339506 -790,-0.993895307221 -647,-0.167296261569 -987,0.514056027644 -968,0.379691401398 -253,0.994823728671 -814,-0.321679488026 -11,-0.999990206551 -613,-0.379663514286 -491,0.790451671234 -319,-0.99177499561 -542,0.997168757104 -124,-0.995686986889 -838,0.720995935398 -265,0.894010170084 -336,0.149847405733 -303,0.986632504844 -796,-0.923481578009 -237,-0.981957869782 -699,0.999990471553 -549,0.702364872321 -500,-0.467771805322 -53,0.395925150182 -35,-0.428182669496 -210,0.467718518343 -782,0.253765048014 -722,-0.536522042161 -316,0.963787348067 -302,0.395952831043 -827,-0.689741594565 -155,-0.873311982775 -805,0.683305734714 -456,-0.452052675883 -579,0.811638606856 -547,0.354966539136 -288,-0.855504370751 -434,0.444139676971 -33,0.999911860107 -807,0.379551962389 -24,-0.905578362007 -643,0.855488761749 -790,-0.993895307221 -265,0.894010170084 -145,0.467745162045 -639,-0.951073282107 -544,-0.483344343168 -331,-0.905591148197 -194,-0.702386329268 -130,-0.930105950187 -252,0.623012211004 -666,-0.0176416458133 -283,0.25385251979 -132,0.0530835871461 -708,-0.909322514128 -628,-0.313171527024 -754,0.0177622043332 -546,-0.594884318359 -263,-0.779447185499 -682,-0.270963822078 -126,0.329990825674 -320,-0.428155428084 -334,0.8366721491 -826,0.236602816898 -75,-0.387781635409 -86,-0.923458447004 -655,0.999756505535 -754,0.0177622043332 -699,0.999990471553 -181,-0.936451400118 -254,0.451998898063 -370,-0.650264939561 -823,-0.0971219023783 -442,0.821800661502 -776,-0.026611421428 -651,-0.636784493411 -327,0.270934805316 -884,-0.936483119966 -40,0.745113160479 -461,0.727121806057 -71,0.951054653254 -95,0.683261714736 -190,0.997799278681 -828,-0.981940764891 -296,0.636761250565 -305,-0.262403941862 -513,-0.795842349412 -693,0.961380900891 -776,-0.026611421428 -95,0.683261714736 -52,0.98662759204 -578,-0.0530233833456 -189,0.483317953668 -181,-0.936451400118 -172,0.708659140182 -59,0.636738007139 -417,0.739160393875 -616,0.245310432473 -516,0.702429241248 -498,0.998343627044 -657,-0.395980511544 -167,-0.475550186872 -40,0.745113160479 -859,-0.974662135376 -754,0.0177622043332 -113,-0.0971819058932 -424,0.11475486862 -621,-0.860038646335 -82,0.313228782433 -239,0.236690681275 -110,-0.0442426780851 -938,0.972609050321 -994,0.951082595236 -74,-0.985146260468 -319,-0.99177499561 -152,0.933320523749 -93,-0.94828214127 -253,0.994823728671 -999,-0.0264607527371 -598,0.890023092537 -708,-0.909322514128 -287,-0.897940948108 -615,-0.683217692275 -738,0.270847753553 -80,-0.993888653923 -221,0.885938797879 -599,0.864521149292 -752,-0.916545660847 -66,-0.026551154024 -421,0.0265812877381 -559,-0.202090837026 -841,-0.811568164468 -477,-0.498687025536 -476,-0.998813757337 -718,0.989349472816 -808,-0.573431264777 -546,-0.594884318359 -483,-0.721016823278 -518,0.354881993716 -240,0.945445154921 -937,0.721100368243 -113,-0.0971819058932 -608,-0.99482066508 -752,-0.916545660847 -306,-0.953761713494 -997,-0.897967480498 -305,-0.262403941862 -78,0.513978455988 -806,0.983576865728 -577,-0.868935919429 -253,0.994823728671 -452,-0.379579850881 -134,0.88592481646 -594,-0.236719968971 -10,-0.544021110889 -53,0.395925150182 -892,-0.210722131299 -39,0.963795386284 -549,0.702364872321 -503,0.3383617608 -884,-0.936483119966 -192,-0.354938357652 -204,0.202120359313 -765,-0.999753837548 -645,-0.826862587603 -405,0.262345765308 -999,-0.0264607527371 -880,0.346706005358 -729,0.149936817113 -526,-0.976597351709 -102,0.994826791358 -146,0.996469173122 -618,0.779428300674 -950,0.945464794136 -737,0.956358313995 -219,-0.790414741493 -734,-0.905552787157 -496,-0.36314327904 -533,-0.877560883034 -638,-0.253881676588 -35,-0.428182669496 -455,0.506339646835 -166,0.483291563728 -753,-0.831741274054 -619,-0.106047460687 -501,-0.996471703572 -207,-0.338305027541 -155,-0.873311982775 -280,-0.387809420829 -14,0.990607355695 -833,-0.459957024351 -360,0.958915723414 -429,0.985141083712 -592,0.981963569628 -41,-0.158622668805 -758,-0.768293253402 -958,0.18469286804 -598,0.890023092537 -374,-0.149907013456 -646,-0.920002411959 -720,-0.544071696438 -560,0.714918585257 -751,-0.158682193925 -137,-0.942514454558 -618,0.779428300674 -39,0.963795386284 -774,0.92004966109 -543,0.47549715072 -825,0.945415689655 -314,-0.158592906029 -717,0.657032049317 -209,0.996466641766 -308,0.123603036 -328,0.956384734305 -806,0.983576865728 -817,0.184840994735 -871,-0.70245069628 -368,-0.420194391032 -971,-0.245339655642 -61,-0.966117770008 -661,0.953770773362 -56,-0.521551002087 -965,-0.506443621173 -836,0.330047736657 -578,-0.0530233833456 -558,-0.933298875737 -964,0.4519451186 -926,0.696015200688 -665,-0.850871852004 -678,-0.551376385992 -976,0.860023265424 -930,0.0884587650136 -699,0.999990471553 -462,-0.184811369732 -469,-0.784999063373 -858,-0.338390126969 -153,0.806400580775 -92,-0.779466069616 -344,-0.999990339506 -214,0.363199451376 -117,-0.689697940935 -498,0.998343627044 -515,-0.219395848565 -180,-0.801152635734 -877,-0.475603221295 -620,-0.894023675755 -231,-0.995684189758 -683,-0.956393539337 -658,-0.986637416751 -506,-0.202179403335 -329,0.762538949168 -439,-0.733169820872 -238,-0.68967611318 -197,0.79580584292 -259,0.983593183947 -203,0.933309700167 -101,0.452025787178 -697,-0.42011232727 -653,-0.436110502648 -540,-0.346592904377 -903,-0.978469019612 -240,0.945445154921 -524,0.601975797253 -740,-0.988022322677 -594,-0.236719968971 -990,-0.387864990612 -281,-0.985151436329 -393,-0.296397368652 -703,-0.656941145733 -852,-0.58784378026 -295,-0.30478191109 -210,0.467718518343 -69,-0.114784813783 -598,0.890023092537 -816,-0.727101111373 -145,0.467745162045 -843,0.868995589841 -756,0.901762290561 -806,0.983576865728 -200,-0.873297297214 -305,-0.262403941862 -52,0.98662759204 -527,-0.708637871481 -964,0.4519451186 -418,-0.167385419442 -294,-0.966109989263 -825,0.945415689655 -963,0.994817600584 -634,-0.566057938 -853,-0.998341892307 -501,-0.996471703572 -725,0.650242038374 -319,-0.99177499561 -630,0.993881997013 -794,0.733149321004 -791,-0.629841167736 -746,-0.991786566406 -611,0.99920923312 -528,0.210839999735 -963,0.994817600584 -87,-0.821817836631 -864,-0.0619805101619 -202,0.806418406866 -423,0.897914412455 -106,-0.727142500081 -948,-0.68963245579 -947,-0.981969268581 -670,-0.745153367958 -874,0.594981235525 -275,-0.99388532592 -725,0.650242038374 -355,-3.01443533595e-05 -501,-0.996471703572 -12,-0.536572918 -220,0.0883987124875 -66,-0.026551154024 -949,0.236749256451 -584,-0.329933913491 -835,-0.61599296778 -410,0.999754505908 -34,0.52908268612 -605,0.970520754664 -672,-0.296310998016 -854,-0.490969072656 -366,0.999990072687 -922,-0.998350556921 -658,-0.986637416751 -947,-0.981969268581 -692,0.751027055047 -68,-0.897927680689 -654,0.521602440676 -123,-0.45990349069 -57,0.436164755248 -765,-0.999753837548 -188,-0.475523669012 -923,-0.587721843522 -86,-0.923458447004 -152,0.933320523749 -663,-0.123632949143 -779,-0.114724923353 -880,0.346706005358 -827,-0.689741594565 -552,-0.795787588589 -262,-0.948291709522 -829,-0.371348124428 -582,-0.721079482984 -205,-0.714897507768 -610,0.506417628279 -943,0.498791536257 -475,-0.580635726907 -343,-0.536598355189 -564,-0.996464109505 -249,-0.727163193444 -671,-0.963779308975 -5,-0.958924274663 -144,-0.491021593898 -949,0.236749256451 -163,-0.354910175845 -577,-0.868935919429 -24,-0.905578362007 -680,0.988040921918 -588,-0.498765409257 -749,0.96381146009 -718,0.989349472816 -290,0.826845633922 -76,0.566107636898 -223,0.0530534852699 -5,-0.958924274663 -867,-0.0794884450788 -882,0.708616602137 -762,0.986617763744 -859,-0.974662135376 -167,-0.475550186872 -883,-0.210869466365 -819,0.816707818437 -40,0.745113160479 -292,0.167325981012 -792,0.313286036704 -216,0.696058488345 -437,-0.313257409711 -893,0.708722942421 -902,-0.354994720298 -468,0.0971519041799 -228,0.972623062486 -429,0.985141083712 -44,0.0177019251054 -323,0.551401533867 -60,-0.304810621102 -622,-0.0353380517466 -544,-0.483344343168 -182,-0.2107810659 -511,0.881770400761 -774,0.92004966109 -471,-0.236632105238 -39,0.963795386284 -841,-0.811568164468 -977,0.0353079262048 -311,0.0176717854674 -338,-0.961389196822 -858,-0.338390126969 -193,-0.978456574622 -894,0.976571411323 -884,-0.936483119966 -623,0.821852184648 -378,0.846236465698 -124,-0.995686986889 -49,-0.953752652759 -994,0.951082595236 -912,0.806454056848 -687,0.846188278824 -276,-0.444085660041 -900,0.997803274422 -197,0.79580584292 -749,0.96381146009 -130,-0.930105950187 -642,0.897954214711 -471,-0.236632105238 -726,-0.287961052193 -207,-0.338305027541 -132,0.0530835871461 -519,-0.594957007044 -553,0.0796086403815 -219,-0.790414741493 -316,0.963787348067 -290,0.826845633922 -303,0.986632504844 -168,-0.997173288774 -362,-0.657009324316 -511,0.881770400761 -338,-0.961389196822 -355,-3.01443533595e-05 -172,0.708659140182 -478,0.459930257729 -448,0.948272572156 -2,0.909297426826 -851,0.363115192377 -861,0.20220892507 -806,0.983576865728 -973,-0.77940941514 -120,0.580611184212 -665,-0.850871852004 -786,0.566157333739 -629,0.629934818523 -303,0.986632504844 -485,0.930117021524 -971,-0.245339655642 -212,-0.998347093797 -103,0.622988631442 -314,-0.158592906029 -7,0.656986598719 -675,0.428128186284 -673,0.643584278011 -991,-0.985161785365 -163,-0.354910175845 -843,0.868995589841 -456,-0.452052675883 -973,-0.77940941514 -148,-0.338333394324 -754,0.0177622043332 -355,-3.01443533595e-05 -431,-0.566132485576 -236,-0.371432089437 -945,0.580537552962 -650,0.304753200801 -707,-0.141179693171 -728,-0.750947435767 -603,-0.184722493715 -166,0.483291563728 -122,0.498713153896 -532,-0.877604238953 -303,0.986632504844 -425,-0.773909772204 -501,-0.996471703572 -51,0.670229175843 -644,0.0264908865234 -320,-0.428155428084 -198,-0.0795785916643 -794,0.733149321004 -281,-0.985151436329 -333,-0.00882116611389 -234,0.998816691203 -747,-0.643491986364 -782,0.253765048014 -746,-0.991786566406 -221,0.885938797879 -7,0.656986598719 -326,-0.663611334201 -647,-0.167296261569 -178,0.877575335804 -634,-0.566057938 -869,0.939499081438 -627,-0.968349414889 -813,0.622941470621 -409,0.558814047606 -328,0.956384734305 -470,-0.945425512269 -827,-0.689741594565 -57,0.436164755248 -882,0.708616602137 -457,-0.994829853142 -798,0.0354585535921 -115,0.945435334025 -817,0.184840994735 -786,0.566157333739 -643,0.855488761749 -429,0.985141083712 -321,0.529108265482 -453,0.573406568644 -725,0.650242038374 -502,-0.609020113022 -284,0.951063968113 -682,-0.270963822078 +153,1000.80640058 +276,999.55591434 +63,1000.1673557 +565,999.532308126 +76,1000.56610764 +609,999.548027991 +525,999.653322269 +834,999.004307422 +169,999.398000132 +375,999.087042448 +526,999.023402648 +78,1000.51397846 +270,999.823954054 +309,1000.90180137 +56,999.478448998 +358,999.858909835 +110,999.955757322 +879,999.398048274 +303,1000.9866325 +282,999.323250235 +305,999.737596058 +274,999.370088593 +320,999.571844572 +891,999.063569751 +307,999.231764636 +235,1000.58058664 +150,999.28512357 +686,1000.90560393 +747,999.356508014 +256,999.000791966 +716,999.72064239 +731,1000.83662262 +33,1000.99991186 +864,999.93801949 +589,999.001181843 +894,1000.97657141 +461,1000.72712181 +834,999.004307422 +585,1000.61608795 +319,999.008225004 +56,999.478448998 +703,999.343058854 +522,1000.4755767 +421,1000.02658129 +743,1000.99991106 +468,1000.0971519 +164,1000.59493278 +526,999.023402648 +341,1000.99060323 +629,1000.62993482 +983,1000.3131429 +352,1000.14114985 +561,1000.97463516 +30,999.011968376 +981,1000.73325181 +144,999.508978406 +567,1000.99834883 +29,999.336366116 +321,1000.52910827 +556,1000.06186016 +938,1000.97260905 +975,1000.89403718 +513,999.204157651 +546,999.405115682 +831,1000.99881229 +862,1000.93334217 +210,1000.46771852 +617,1000.94830128 +605,1000.97052075 +812,1000.99483291 +811,1000.45207956 +789,999.555833315 +368,999.579805609 +600,1000.04418245 +593,1000.68965428 +395,999.254906944 +138,999.77194774 +285,1000.77387159 +228,1000.97262306 +200,999.126702703 +293,999.260799001 +226,999.806556183 +799,1000.86010016 +738,1000.27084775 +938,1000.97260905 +389,999.470942894 +399,999.982267935 +584,999.670066087 +941,999.004321407 +890,999.198811285 +138,999.77194774 +635,1000.38783721 +924,1000.36325562 +822,999.110031887 +494,999.303898227 +629,1000.62993482 +348,1000.65696387 +900,1000.99780327 +76,1000.56610764 +387,999.448548172 +721,999.000010062 +233,1000.49873928 +639,999.048926718 +438,999.031628017 +807,1000.37955196 +982,1000.96834189 +841,999.188431836 +55,999.000244827 +744,1000.52903153 +556,1000.06186016 +862,1000.93334217 +706,1000.75676309 +739,999.336321018 +26,1000.76255845 +315,1000.74513326 +304,1000.6702068 +169,999.398000132 +397,1000.9165336 +861,1000.20220893 +809,999.000795568 +740,999.011977677 +737,1000.95635831 +561,1000.97463516 +814,999.678320512 +978,999.178130642 +322,1000.99991226 +212,999.001652906 +18,999.249012753 +410,1000.99975451 +426,999.048954662 +570,999.019748416 +737,1000.95635831 +503,1000.33836176 +929,999.209622191 +479,1000.99568978 +931,1000.88596676 +595,999.054545025 +389,999.470942894 +85,999.82392438 +480,1000.61601671 +386,1000.40401007 +278,1000.99952109 +840,999.069871908 +480,1000.61601671 +36,999.008221147 +754,1000.0177622 +480,1000.61601671 +661,1000.95377077 +554,1000.88181305 +167,999.524449813 +109,1000.81674261 +763,1000.39586979 +503,1000.33836176 +119,999.628595899 +430,1000.38775385 +441,1000.92347001 +803,999.051736998 +906,1000.9395507 +490,999.91166134 +545,999.002198723 +145,1000.46774516 +224,999.188379003 +353,1000.90930997 +197,1000.79580584 +590,999.419437903 +669,1000.15856314 +105,999.029464716 +27,1000.95637593 +750,1000.74507295 +859,999.025337865 +253,1000.99482373 +122,1000.49871315 +95,1000.68326171 +969,1000.98360406 +844,1000.88589685 +727,999.038585921 +97,1000.37960774 +687,1000.84618828 +797,999.178216514 +793,1000.9683795 +33,1000.99991186 +39,1000.96379539 +497,1000.58781939 +185,1000.34662118 +311,1000.01767179 +122,1000.49871315 +824,1000.78501774 +544,999.516655657 +755,1000.85093519 +392,1000.64351506 +301,999.44123595 +864,999.93801949 +580,1000.9300838 +944,1000.99881962 +721,999.000010062 +129,999.806526608 +127,1000.97263007 +91,1000.10598751 +568,1000.58774623 +622,999.964661948 +397,1000.9165336 +747,999.356508014 +360,1000.95891572 +805,1000.68330573 +829,999.628651876 +869,1000.93949908 +401,999.09822468 +847,999.057505694 +33,1000.99991186 +491,1000.79045167 +445,999.106016844 +935,999.069927269 +526,999.023402648 +261,999.754718791 +862,1000.93334217 +440,1000.17610529 +474,1000.37137611 +53,1000.39592515 +605,1000.97052075 +427,999.746205794 +557,999.193563768 +135,1000.08836869 +258,1000.37963563 +973,999.220590585 +630,1000.993882 +139,1000.69608013 +429,1000.98514108 +552,999.204212411 +751,999.841317806 +705,1000.95894137 +542,1000.99716876 +986,999.555968359 +287,999.102059052 +358,999.858909835 +149,999.025351352 +844,1000.88589685 +363,999.01064614 +848,999.772006441 +998,999.144526848 +609,999.548027991 +583,999.027383943 +508,999.193617246 +103,1000.62298863 +8,1000.98935825 +419,999.07996215 +135,1000.08836869 +796,999.076518422 +111,999.135448551 +872,999.0215621 +226,999.806556183 +834,999.004307422 +255,999.493608365 +673,1000.64358428 +303,1000.9866325 +242,999.902788092 +470,999.054574488 +252,1000.62301221 +12,999.463427082 +407,999.013377322 +728,999.249052564 +656,1000.55873905 +881,1000.97660383 +769,1000.63669152 +405,1000.26234577 +702,999.010632983 +510,1000.87332667 +958,1000.18469287 +779,999.885275077 +223,1000.05305349 +218,999.057475473 +59,1000.63673801 +852,999.41215622 +622,999.964661948 +825,1000.94541569 +655,1000.99975651 +228,1000.97262306 +240,1000.94544515 +403,1000.76827396 +188,999.524476331 +42,999.083478452 +501,999.003528296 +49,999.046247347 +671,999.036220691 +610,1000.50641763 +935,999.069927269 +713,1000.14106032 +427,999.746205794 +719,1000.41206355 +154,999.938079663 +290,1000.82684563 +322,1000.99991226 +431,999.433867514 +369,999.009388523 +437,999.68674259 +835,999.384007032 +61,999.03388223 +6,999.720584502 +706,1000.75676309 +151,1000.20214988 +884,999.06351688 +290,1000.82684563 +715,999.041092829 +553,1000.07960864 +422,1000.85553559 +27,1000.95637593 +897,999.00283351 +165,1000.99779728 +461,1000.72712181 +171,1000.97659087 +719,1000.41206355 +97,1000.37960774 +591,1000.37146008 +102,1000.99482679 +432,999.000480776 +452,999.620420149 +819,1000.81670782 +551,999.060459621 +723,1000.42022174 +763,1000.39586979 +235,1000.58058664 +546,999.405115682 +525,999.653322269 +382,999.043632878 +628,999.686828473 +400,999.14908064 +152,1000.93332052 +402,999.876456791 +205,999.285102492 +704,1000.27947339 +551,999.060459621 +47,1000.12357312 +76,1000.56610764 +354,1000.8414547 +326,999.336388666 +151,1000.20214988 +292,1000.16732598 +201,999.938109749 +907,1000.79576933 +593,1000.68965428 +880,1000.34670601 +557,999.193563768 +301,999.44123595 +919,1000.99646158 +634,999.433942062 +153,1000.80640058 +487,999.946886311 +450,999.316716275 +757,1000.1235133 +913,1000.93328805 +754,1000.0177622 +671,999.036220691 +518,1000.35488199 +516,1000.70242924 +809,999.000795568 +765,999.000246162 +666,999.982358354 +850,1000.98022773 +200,999.126702703 +321,1000.52910827 +249,999.272836807 +141,1000.36317137 +338,999.038610803 +840,999.069871908 +392,1000.64351506 +987,1000.51405603 +370,999.34973506 +215,1000.98024562 +100,999.493634359 +752,999.083454339 +11,999.000009793 +78,1000.51397846 +933,1000.05299328 +860,999.285165729 +424,1000.11475487 +80,999.006111346 +329,1000.76253895 +547,1000.35496654 +665,999.149128148 +271,1000.73321082 +416,1000.96612555 +67,999.144480021 +11,999.000009793 +858,999.661609873 +277,1000.51400431 +493,1000.22802291 +506,999.797820597 +494,999.303898227 +917,999.661751707 +75,999.612218365 +398,1000.83175801 +293,999.260799001 +841,999.188431836 +342,1000.42013968 +22,999.991148691 +698,1000.53662379 +556,1000.06186016 +180,999.198847364 +481,999.669980719 +349,999.720555558 +202,1000.80641841 +517,1000.97844413 +258,1000.37963563 +699,1000.99999047 +34,1000.52908269 +435,1000.99389198 +967,999.426692221 +846,999.209529865 +269,999.07655312 +939,1000.32990546 +753,999.168258726 +288,999.144495629 +53,1000.39592515 +117,999.310302059 +800,1000.89396965 +315,1000.74513326 +252,1000.62301221 +299,999.478423278 +247,1000.92680719 +462,999.81518863 +858,999.661609873 +310,1000.85088769 +473,1000.98194647 +967,999.426692221 +869,1000.93949908 +746,999.008213434 +270,999.823954054 +817,1000.18484099 +17,999.038602508 +710,1000.00006029 +65,1000.82682868 +835,999.384007032 +800,1000.89396965 +762,1000.98661776 +900,1000.99780327 +953,999.109963165 +101,1000.45202579 +851,1000.36311519 +966,999.000789569 +266,1000.86005403 +946,999.628511936 +947,999.018030731 +812,1000.99483291 +255,999.493608365 +962,1000.62305937 +898,999.524529368 +821,999.135418255 +933,1000.05299328 +273,1000.31320015 +363,999.01064614 +585,1000.61608795 +882,1000.7086166 +640,999.226147502 +556,1000.06186016 +64,1000.92002604 +556,1000.06186016 +504,1000.97465539 +765,999.000246162 +109,1000.81674261 +90,1000.89399666 +9,1000.41211849 +958,1000.18469287 +848,999.772006441 +811,1000.45207956 +331,999.094408852 +610,1000.50641763 +220,1000.08839871 +327,1000.27093481 +521,999.516734827 +627,999.031650585 +936,999.806615333 +763,1000.39586979 +416,1000.96612555 +652,999.007134539 +563,999.390908162 +475,999.419364273 +630,1000.993882 +214,1000.36319945 +529,1000.93647255 +224,999.188379003 +814,999.678320512 +203,1000.9333097 +394,999.036196576 +609,999.548027991 +974,1000.10607744 +250,999.02947198 +71,1000.95105465 +841,999.188431836 +585,1000.61608795 +344,999.00000966 +790,999.006104693 +647,999.832703738 +987,1000.51405603 +968,1000.3796914 +253,1000.99482373 +814,999.678320512 +11,999.000009793 +613,999.620336486 +491,1000.79045167 +319,999.008225004 +542,1000.99716876 +124,999.004313013 +838,1000.72099594 +265,1000.89401017 +336,1000.14984741 +303,1000.9866325 +796,999.076518422 +237,999.01804213 +699,1000.99999047 +549,1000.70236487 +500,999.532228195 +53,1000.39592515 +35,999.571817331 +210,1000.46771852 +782,1000.25376505 +722,999.463477958 +316,1000.96378735 +302,1000.39595283 +827,999.310258405 +155,999.126688017 +805,1000.68330573 +456,999.547947324 +579,1000.81163861 +547,1000.35496654 +288,999.144495629 +434,1000.44413968 +33,1000.99991186 +807,1000.37955196 +24,999.094421638 +643,1000.85548876 +790,999.006104693 +265,1000.89401017 +145,1000.46774516 +639,999.048926718 +544,999.516655657 +331,999.094408852 +194,999.297613671 +130,999.06989405 +252,1000.62301221 +666,999.982358354 +283,1000.25385252 +132,1000.05308359 +708,999.090677486 +628,999.686828473 +754,1000.0177622 +546,999.405115682 +263,999.220552815 +682,999.729036178 +126,1000.32999083 +320,999.571844572 +334,1000.83667215 +826,1000.23660282 +75,999.612218365 +86,999.076541553 +655,1000.99975651 +754,1000.0177622 +699,1000.99999047 +181,999.0635486 +254,1000.4519989 +370,999.34973506 +823,999.902878098 +442,1000.82180066 +776,999.973388579 +651,999.363215507 +327,1000.27093481 +884,999.06351688 +40,1000.74511316 +461,1000.72712181 +71,1000.95105465 +95,1000.68326171 +190,1000.99779928 +828,999.018059235 +296,1000.63676125 +305,999.737596058 +513,999.204157651 +693,1000.9613809 +776,999.973388579 +95,1000.68326171 +52,1000.98662759 +578,999.946976617 +189,1000.48331795 +181,999.0635486 +172,1000.70865914 +59,1000.63673801 +417,1000.73916039 +616,1000.24531043 +516,1000.70242924 +498,1000.99834363 +657,999.604019488 +167,999.524449813 +40,1000.74511316 +859,999.025337865 +754,1000.0177622 +113,999.902818094 +424,1000.11475487 +621,999.139961354 +82,1000.31322878 +239,1000.23669068 +110,999.955757322 +938,1000.97260905 +994,1000.9510826 +74,999.01485374 +319,999.008225004 +152,1000.93332052 +93,999.051717859 +253,1000.99482373 +999,999.973539247 +598,1000.89002309 +708,999.090677486 +287,999.102059052 +615,999.316782308 +738,1000.27084775 +80,999.006111346 +221,1000.8859388 +599,1000.86452115 +752,999.083454339 +66,999.973448846 +421,1000.02658129 +559,999.797909163 +841,999.188431836 +477,999.501312974 +476,999.001186243 +718,1000.98934947 +808,999.426568735 +546,999.405115682 +483,999.278983177 +518,1000.35488199 +240,1000.94544515 +937,1000.72110037 +113,999.902818094 +608,999.005179335 +752,999.083454339 +306,999.046238287 +997,999.10203252 +305,999.737596058 +78,1000.51397846 +806,1000.98357687 +577,999.131064081 +253,1000.99482373 +452,999.620420149 +134,1000.88592482 +594,999.763280031 +10,999.455978889 +53,1000.39592515 +892,999.789277869 +39,1000.96379539 +549,1000.70236487 +503,1000.33836176 +884,999.06351688 +192,999.645061642 +204,1000.20212036 +765,999.000246162 +645,999.173137412 +405,1000.26234577 +999,999.973539247 +880,1000.34670601 +729,1000.14993682 +526,999.023402648 +102,1000.99482679 +146,1000.99646917 +618,1000.7794283 +950,1000.94546479 +737,1000.95635831 +219,999.209585259 +734,999.094447213 +496,999.636856721 +533,999.122439117 +638,999.746118323 +35,999.571817331 +455,1000.50633965 +166,1000.48329156 +753,999.168258726 +619,999.893952539 +501,999.003528296 +207,999.661694972 +155,999.126688017 +280,999.612190579 +14,1000.99060736 +833,999.540042976 +360,1000.95891572 +429,1000.98514108 +592,1000.98196357 +41,999.841377331 +758,999.231706747 +958,1000.18469287 +598,1000.89002309 +374,999.850092987 +646,999.079997588 +720,999.455928304 +560,1000.71491859 +751,999.841317806 +137,999.057485545 +618,1000.7794283 +39,1000.96379539 +774,1000.92004966 +543,1000.47549715 +825,1000.94541569 +314,999.841407094 +717,1000.65703205 +209,1000.99646664 +308,1000.12360304 +328,1000.95638473 +806,1000.98357687 +817,1000.18484099 +871,999.297549304 +368,999.579805609 +971,999.754660344 +61,999.03388223 +661,1000.95377077 +56,999.478448998 +965,999.493556379 +836,1000.33004774 +578,999.946976617 +558,999.066701124 +964,1000.45194512 +926,1000.6960152 +665,999.149128148 +678,999.448623614 +976,1000.86002327 +930,1000.08845877 +699,1000.99999047 +462,999.81518863 +469,999.215000937 +858,999.661609873 +153,1000.80640058 +92,999.22053393 +344,999.00000966 +214,1000.36319945 +117,999.310302059 +498,1000.99834363 +515,999.780604151 +180,999.198847364 +877,999.524396779 +620,999.105976324 +231,999.00431581 +683,999.043606461 +658,999.013362583 +506,999.797820597 +329,1000.76253895 +439,999.266830179 +238,999.310323887 +197,1000.79580584 +259,1000.98359318 +203,1000.9333097 +101,1000.45202579 +697,999.579887673 +653,999.563889497 +540,999.653407096 +903,999.02153098 +240,1000.94544515 +524,1000.6019758 +740,999.011977677 +594,999.763280031 +990,999.612135009 +281,999.014848564 +393,999.703602631 +703,999.343058854 +852,999.41215622 +295,999.695218089 +210,1000.46771852 +69,999.885215186 +598,1000.89002309 +816,999.272898889 +145,1000.46774516 +843,1000.86899559 +756,1000.90176229 +806,1000.98357687 +200,999.126702703 +305,999.737596058 +52,1000.98662759 +527,999.291362129 +964,1000.45194512 +418,999.832614581 +294,999.033890011 +825,1000.94541569 +963,1000.9948176 +634,999.433942062 +853,999.001658108 +501,999.003528296 +725,1000.65024204 +319,999.008225004 +630,1000.993882 +794,1000.73314932 +791,999.370158832 +746,999.008213434 +611,1000.99920923 +528,1000.21084 +963,1000.9948176 +87,999.178182163 +864,999.93801949 +202,1000.80641841 +423,1000.89791441 +106,999.2728575 +948,999.310367544 +947,999.018030731 +670,999.254846632 +874,1000.59498124 +275,999.006114674 +725,1000.65024204 +355,999.999969856 +501,999.003528296 +12,999.463427082 +220,1000.08839871 +66,999.973448846 +949,1000.23674926 +584,999.670066087 +835,999.384007032 +410,1000.99975451 +34,1000.52908269 +605,1000.97052075 +672,999.703689002 +854,999.509030927 +366,1000.99999007 +922,999.001649443 +658,999.013362583 +947,999.018030731 +692,1000.75102706 +68,999.102072319 +654,1000.52160244 +123,999.540096509 +57,1000.43616476 +765,999.000246162 +188,999.524476331 +923,999.412278156 +86,999.076541553 +152,1000.93332052 +663,999.876367051 +779,999.885275077 +880,1000.34670601 +827,999.310258405 +552,999.204212411 +262,999.05170829 +829,999.628651876 +582,999.278920517 +205,999.285102492 +610,1000.50641763 +943,1000.49879154 +475,999.419364273 +343,999.463401645 +564,999.00353589 +249,999.272836807 +671,999.036220691 +5,999.041075725 +144,999.508978406 +949,1000.23674926 +163,999.645089824 +577,999.131064081 +24,999.094421638 +680,1000.98804092 +588,999.501234591 +749,1000.96381146 +718,1000.98934947 +290,1000.82684563 +76,1000.56610764 +223,1000.05305349 +5,999.041075725 +867,999.920511555 +882,1000.7086166 +762,1000.98661776 +859,999.025337865 +167,999.524449813 +883,999.789130534 +819,1000.81670782 +40,1000.74511316 +292,1000.16732598 +792,1000.31328604 +216,1000.69605849 +437,999.68674259 +893,1000.70872294 +902,999.64500528 +468,1000.0971519 +228,1000.97262306 +429,1000.98514108 +44,1000.01770193 +323,1000.55140153 +60,999.695189379 +622,999.964661948 +544,999.516655657 +182,999.789218934 +511,1000.8817704 +774,1000.92004966 +471,999.763367895 +39,1000.96379539 +841,999.188431836 +977,1000.03530793 +311,1000.01767179 +338,999.038610803 +858,999.661609873 +193,999.021543425 +894,1000.97657141 +884,999.06351688 +623,1000.82185218 +378,1000.84623647 +124,999.004313013 +49,999.046247347 +994,1000.9510826 +912,1000.80645406 +687,1000.84618828 +276,999.55591434 +900,1000.99780327 +197,1000.79580584 +749,1000.96381146 +130,999.06989405 +642,1000.89795421 +471,999.763367895 +726,999.712038948 +207,999.661694972 +132,1000.05308359 +519,999.405042993 +553,1000.07960864 +219,999.209585259 +316,1000.96378735 +290,1000.82684563 +303,1000.9866325 +168,999.002826711 +362,999.342990676 +511,1000.8817704 +338,999.038610803 +355,999.999969856 +172,1000.70865914 +478,1000.45993026 +448,1000.94827257 +2,1000.90929743 +851,1000.36311519 +861,1000.20220893 +806,1000.98357687 +973,999.220590585 +120,1000.58061118 +665,999.149128148 +786,1000.56615733 +629,1000.62993482 +303,1000.9866325 +485,1000.93011702 +971,999.754660344 +212,999.001652906 +103,1000.62298863 +314,999.841407094 +7,1000.6569866 +675,1000.42812819 +673,1000.64358428 +991,999.014838215 +163,999.645089824 +843,1000.86899559 +456,999.547947324 +973,999.220590585 +148,999.661666606 +754,1000.0177622 +355,999.999969856 +431,999.433867514 +236,999.628567911 +945,1000.58053755 +650,1000.3047532 +707,999.858820307 +728,999.249052564 +603,999.815277506 +166,1000.48329156 +122,1000.49871315 +532,999.122395761 +303,1000.9866325 +425,999.226090228 +501,999.003528296 +51,1000.67022918 +644,1000.02649089 +320,999.571844572 +198,999.920421408 +794,1000.73314932 +281,999.014848564 +333,999.991178834 +234,1000.99881669 +747,999.356508014 +782,1000.25376505 +746,999.008213434 +221,1000.8859388 +7,1000.6569866 +326,999.336388666 +647,999.832703738 +178,1000.87757534 +634,999.433942062 +869,1000.93949908 +627,999.031650585 +813,1000.62294147 +409,1000.55881405 +328,1000.95638473 +470,999.054574488 +827,999.310258405 +57,1000.43616476 +882,1000.7086166 +457,999.005170147 +798,1000.03545855 +115,1000.94543533 +817,1000.18484099 +786,1000.56615733 +643,1000.85548876 +429,1000.98514108 +321,1000.52910827 +453,1000.57340657 +725,1000.65024204 +502,999.390979887 +284,1000.95106397 +682,999.729036178 diff --git a/data/xydata.csv b/data/xydata.csv index 726cb65..1ad991d 100644 --- a/data/xydata.csv +++ b/data/xydata.csv @@ -1,4 +1,3 @@ -X,y 609,-0.451972008537 153,0.806400580775 276,-0.444085660041