Skip to content

Commit

Permalink
prep for version 3.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gplepage committed May 30, 2014
1 parent fa69e6f commit 8f80cc5
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 29 deletions.
24 changes: 22 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,33 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

Version 3.7+ - ????
====================
Version 3.7.1 - 2014-05-30
===========================
Small updates.

- Allow tol=(reltol,abstol) in CorrFitter so relative and absolute
fit tolerances can be set separately. In the past tol was a single
number which was used for both reltol and abstol. This is still
supported but one can instead use a tuple to specify them separately.
The default tolerance (1e-10) is probably smaller than it should be;
1e-4 is probably good enough for many applications.

- New function corrfitter.read_dataset(files) reads Monte Carlo data
for correlators into a gvar.dataset.Dataset. Instead of writing

dset = gvar.dataset.Dataset(files)

one can now write

dset = corrfitter.read_dataset(files)

Either method works, but the second method supports a new file format
for correlator data. A lot of simulation code dumps each correlator
into a separate file, with each line having a t and G(t). This format
can be read by read_data directly, without having to convert to the
traditional gvar.dataset.Dataset format. To use this format, argument
files has to be a dictionary. Each key k is the name (datatag) of a correlator,
and files[k] is the name of the file containing that correlator's data.

Version 3.7 - 2014-05-12
=========================
Expand Down
3 changes: 2 additions & 1 deletion INSTALLATION
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ To install:
successful if the output ends with "OK". (To test an installation
for a different version of Python, say python3, use 'make PYTHON=python3
tests'.) If 'make' is unavailable (non-unix systems),
'python -m unittest discover' can be used to run the tests.
'python -m unittest discover' can be used to run the tests from
inside the tests/ directory.

4. (Optional) Look at the examples of corrfitter use in the examples/
directory; run them all using 'make run-examples'.
Expand Down
76 changes: 75 additions & 1 deletion corrfitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@
import numpy
import math
import collections
import fileinput
import copy
import time
__version__ = '3.7'
__version__ = '3.7.1'

if not hasattr(collections,'OrderedDict'):
# for older versions of python
Expand Down Expand Up @@ -1612,4 +1613,77 @@ def __init__(
self.Q = numpy.array([self.Q, lsqfit.wavg.Q])


def read_dataset(inputfiles, tcol=0, Gcol=1):
""" Read correlator Monte Carlo data from files into a :class:`gvar.dataset.Dataset`.
Two files formats are supported by :func:`read_dataset`, depending upon the
data type of ``inputfiles``.
The first file format is that normally used by :class:`gvar.dataset.Dataset`:
each line consists of a tag or key identifying a correlator
followed by data corresponding to a single Monte Carlo measurement of the
correlator. This format is assumed if ``inputfiles`` is a filename or a
list of filenames. It allows a single file to contain an arbitrary number
of measurements for an arbitrary number of different correlators. The data
can also be spread over multiple files. A typical file might look like ::
# this is a comment; it is ignored
aa 1.237 0.912 0.471
bb 3.214 0.535 0.125
aa 1.035 0.851 0.426
bb 2.951 0.625 0.091
...
which describes two correlators, ``aa`` and ``bb``, each having
three different ``t`` values.
The second file format is assumed when ``inputfiles`` is a dictionary. The
dictionary's keys and values identify the (one-dimensional) correlators
and the files containing their Monte Carlo data, respectively. So the
data for correlators ``aa`` and ``bb`` above are in separate files::
fileinputs = dict(aa='aafile', bb='bbfile')
Each line in these data files consists of an index ``t`` value followed by
the corresponding value for correlator ``G(t)``. The ``t``\s increase
from line to line up to their maximum value, at which point they repeat.
The ``aafile`` file for correlator ``aa`` above would look like::
# this is a comment; it is ignored
1 1.237
2 0.912
3 0.471
1 1.035
2 0.851
3 0.426
...
The columns in these files containing ``t`` and ``G(t)`` are
assumed to be columns 0 and 1, respectively. These can be changed
by setting arguments ``tcol`` and ``Gcol``, respectively.
"""
if not hasattr(inputfiles, 'keys'):
# inputfiles is a filename or list of filenames (or files)
return _gvar.dataset.Dataset(inputfiles)
# inputfiles is a dictionary
# files are in t-G format
dset = _gvar.dataset.Dataset()
for k in inputfiles:
tlast = - float('inf')
G = []
for line in fileinput.input([inputfiles[k]]):
f = line.split()
if f[0][0] == '#':
# comment
continue
t = eval(f[tcol])
if t <= tlast:
dset.append(k, numpy.array(G))
G = [eval(f[Gcol])]
else:
G.append(eval(f[Gcol]))
tlast = t
dset.append(k, numpy.array(G))
return dset


2 changes: 1 addition & 1 deletion doc/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: c14d310d52f00576391659d848229956
config: f129d7bbd794bbe8b972258072992f86
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified doc/html/.doctrees/corrfitter.doctree
Binary file not shown.
Binary file modified doc/html/.doctrees/environment.pickle
Binary file not shown.
10 changes: 5 additions & 5 deletions doc/html/corrfitter.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>corrfitter - Least-Squares Fit to Correlators &mdash; corrfitter 3.7 documentation</title>
<title>corrfitter - Least-Squares Fit to Correlators &mdash; corrfitter 3.7.1 documentation</title>

<link rel="stylesheet" href="_static/pyramid.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.7',
VERSION: '3.7.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -23,7 +23,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="corrfitter 3.7 documentation" href="index.html" />
<link rel="top" title="corrfitter 3.7.1 documentation" href="index.html" />
<link rel="prev" title="corrfitter Documentation" href="index.html" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
Expand All @@ -43,7 +43,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="index.html" title="corrfitter Documentation"
accesskey="P">previous</a> |</li>
<li><a href="index.html">corrfitter 3.7 documentation</a> &raquo;</li>
<li><a href="index.html">corrfitter 3.7.1 documentation</a> &raquo;</li>
</ul>
</div>

Expand Down Expand Up @@ -2802,7 +2802,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="index.html" title="corrfitter Documentation"
>previous</a> |</li>
<li><a href="index.html">corrfitter 3.7 documentation</a> &raquo;</li>
<li><a href="index.html">corrfitter 3.7.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Expand Down
10 changes: 5 additions & 5 deletions doc/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Index &mdash; corrfitter 3.7 documentation</title>
<title>Index &mdash; corrfitter 3.7.1 documentation</title>

<link rel="stylesheet" href="_static/pyramid.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.7',
VERSION: '3.7.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="corrfitter 3.7 documentation" href="index.html" />
<link rel="top" title="corrfitter 3.7.1 documentation" href="index.html" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
Expand All @@ -40,7 +40,7 @@ <h3>Navigation</h3>
<li class="right" style="margin-right: 10px">
<a href="#" title="General Index"
accesskey="I">index</a></li>
<li><a href="index.html">corrfitter 3.7 documentation</a> &raquo;</li>
<li><a href="index.html">corrfitter 3.7.1 documentation</a> &raquo;</li>
</ul>
</div>

Expand Down Expand Up @@ -312,7 +312,7 @@ <h3>Navigation</h3>
<li class="right" style="margin-right: 10px">
<a href="#" title="General Index"
>index</a></li>
<li><a href="index.html">corrfitter 3.7 documentation</a> &raquo;</li>
<li><a href="index.html">corrfitter 3.7.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Expand Down
10 changes: 5 additions & 5 deletions doc/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>corrfitter Documentation &mdash; corrfitter 3.7 documentation</title>
<title>corrfitter Documentation &mdash; corrfitter 3.7.1 documentation</title>

<link rel="stylesheet" href="_static/pyramid.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.7',
VERSION: '3.7.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -23,7 +23,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="corrfitter 3.7 documentation" href="#" />
<link rel="top" title="corrfitter 3.7.1 documentation" href="#" />
<link rel="next" title="corrfitter - Least-Squares Fit to Correlators" href="corrfitter.html" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
Expand All @@ -43,7 +43,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="corrfitter.html" title="corrfitter - Least-Squares Fit to Correlators"
accesskey="N">next</a> |</li>
<li><a href="#">corrfitter 3.7 documentation</a> &raquo;</li>
<li><a href="#">corrfitter 3.7.1 documentation</a> &raquo;</li>
</ul>
</div>

Expand Down Expand Up @@ -129,7 +129,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="corrfitter.html" title="corrfitter - Least-Squares Fit to Correlators"
>next</a> |</li>
<li><a href="#">corrfitter 3.7 documentation</a> &raquo;</li>
<li><a href="#">corrfitter 3.7.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Expand Down
Binary file modified doc/html/objects.inv
Binary file not shown.
10 changes: 5 additions & 5 deletions doc/html/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Search &mdash; corrfitter 3.7 documentation</title>
<title>Search &mdash; corrfitter 3.7.1 documentation</title>

<link rel="stylesheet" href="_static/pyramid.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.7',
VERSION: '3.7.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/searchtools.js"></script>
<link rel="top" title="corrfitter 3.7 documentation" href="index.html" />
<link rel="top" title="corrfitter 3.7.1 documentation" href="index.html" />
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
Expand All @@ -47,7 +47,7 @@ <h3>Navigation</h3>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li><a href="index.html">corrfitter 3.7 documentation</a> &raquo;</li>
<li><a href="index.html">corrfitter 3.7.1 documentation</a> &raquo;</li>
</ul>
</div>

Expand Down Expand Up @@ -95,7 +95,7 @@ <h3>Navigation</h3>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li><a href="index.html">corrfitter 3.7 documentation</a> &raquo;</li>
<li><a href="index.html">corrfitter 3.7.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Expand Down
Loading

0 comments on commit 8f80cc5

Please sign in to comment.