Name: MahonFitting
Owner: Lawrence Livermore National Laboratory
Description: Python code to fit isochrons according to prescription by Mahon (1996)
Created: 2018-02-01 21:21:55.0
Updated: 2018-03-27 20:35:44.0
Pushed: 2018-03-27 20:39:36.0
Homepage: null
Size: 81
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This routine performs linear regressions to a set of measurement that have uncertainties in both axes, which we subsequently call x and y. The regression is based on the approach by Mahon (1996) and is the same regression as used by York (1969), however, with the corrected calculation for the uncertainties. The code presented here accompanies the publication of Trappitsch et al. (2018). If you want, please cite Trappitsch et al. (2018) as a reference for pointing at this tool.
The fitting program can read text files and csv files. The general format of your file has to be:
Column 1 | Column 2 | Column 3 | Column 4 | Column 5 (optional)| ———|—————————|———-|————————–|———- x values | uncertainties of x values | y values | uncertainties of y values | Correlation values
For text files you can seperate the individual values with a space or a tab, for csv values with a comma. There has to be a line break to separate between different datapoints.
The correlation value column (Column 5) is optional. If you do not provide a fifth column, correlation values are assumed to be 0.
If you would like to have a header column, the first entry of that column has to start with a # (as a comment line).
The testfiles that are provided are the files that come from the dataset published in Mahon (1996) and can be used for validation.
Important: Do not use UTF-8 encoding when exporting your data to .txt or .csv
If you want to calculate a regression, please follow this procedure. We assume you have prepared a file data.txt that is prepared as described above.
If you would like to see your data along with the regression in a quick plot hit the Plot button. This gives you a rough overview. if you would like you can save the plot using the button at the bottom.
If you want fix the y-axis intercept, click the check box and type in the intercept value that you want to fix. The software then artificially adds another datapoint to the regression with the (x, y) values (0, f0), where f0 is the typed in intercept. The uncertainties for the intercept are chosen such that they are 1012 times lower than the smallest uncertainty in your dataset.
If you run a regression, the program will automatically write an output file. If our input file is named test.txt, your output file will be named test_out.txt. Old output files are overwritten without asking. The output file will contain the following:
Since the slope of the regression is calculated iteratively (see equation (9) in Mahon, 1996), there is a chance that the iterative process does not converge. In this case, the python routine stops after 106 iterations and will give you an error message such that you can see how well it converged and decide for yourself if it is acceptable or not. Please also have a look at the regression and see if it looks reasonable, check if the configuration that you want to have regressed is reasonable. If the problem consists, you find another problem, or have problems using this software, feel free to contact me.
You can find full standalone programs that include the necessary python libraries in the released folder or by clicking here. All precompiled packages have been generated using the pyinstaller package.
There is no real installation necessary, however, if you would like to run the source using your own python distriution, you can download the the the mahon.py file and run it from your python distribution. The program was written in python2.7 and the required packages are:
Of course you can always run the script from a terminal by calling
python mahon.py
where python
is the shortcut for your python distribution.
Here are step by step instructions for creating an exectuable for running your program.
$APPFOLDER
here)/usr/bin/python
, modify the first line of the command file to point to your python distribution (for most OSX systems, this step can be skipped)cd $APPFOLDER
chmod 755 mahon.py
./mahon.command
Windows does not come natively with python. If you have your own python installation, chances are you already know how to run the script. If you don't have your own python and would like to still run from source (or if the executable does not work for some reason), please follow these instructions.
$APPFOLDER
here)PATH_TO_PYTHON\pythonw.exe $APPFOLDER\mahon.py
If you find a bug or problem with the software or if you can't get it to run on your machine (and have read this readme file), feel free to contact me (Reto Trappitsch) at trappitsch1@llnl.gov.
Mahon K. I. (1996) The New “York” Regression: Application of an Improved Statistical Method to Geochemistry, International Geology Review, 38:293-303.
York D. (1969) Least squares fitting of a straight line with correlated errors, Earth & Planetary Science Letters, 5:320-324.
Trappitsch R., Boehnke P., Stephan T., Telus M., Savina M. R., Pardo O., Davis A. M., Dauphas N., Pellin M. J., adn Huss G. (2018) New Constraints for the Low Abundance of 60Fe in the Early Solar System, The Astrophysical Journal Letters, in prep.
Copyright (c) 2018, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory. Written by Reto Trappitsch trappitsch1@llnl.gov
LLNL-CODE-745740 All rights reserved. This file is part of MahonFitting v1.0
Please also read this link ? Our Disclaimer and GNU General Public License.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (as published by the Free Software Foundation) version 2, dated June 1991.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and conditions of the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA