Giter VIP home page Giter VIP logo

probedatatools's Introduction

ProbeDataTools

This package contains a series of python scripts which process mineral or liquid data acquired using an Electron MicroProbe. It presents an alternative to traditional complex spreadsheets which are prone to user error as they often need to be adapted to cater for the oxides measured.

This package contains a comma-seperated-variable file (oxides.csv) which has information about 46 commonly measured oxides. This can easily be added to, to cater for other oxides. No changes to the code itself are required, minimising user error.

This package has functionality for the following:

  • Convert mineral data from wt% oxide to cations per formula unit for any mineral given an ideal number of cations and anions per formula unit.
  • Estimate Fe2O3 contents from FeOT using different stoichiometric methods.
  • Calculate endmember proportions for common minerals.
  • Identify potentially anomalous analyses based on cation per formula unit totals.
  • Convert liquid data from wt% oxide to molar or cation fractions.

Detailed examples of the above can be found in the test.py script using a compilation of analyses of volcanic products from Villarrica volcano, Chile.

Basic Usage

This package utilises the commonly used data manipulation package pandas (https://pandas.pydata.org/). Therefore you should load your data into python using one of their reader functions e.g., pandas.read_csv() or pandas.read_excel(). The data must be formated so that each row represents an analysis, and columns have headers for each oxide e.g. SiO2 or Al2O3.

# read in raw data from an excel spreadsheet
Ol_raw = pd.read_excel("olivine_data.xlsx")

The package contains a data class probedata that contains the raw data you want to process and all the relevant data for processing it. This requires a pandas DataFrame containing the raw data and a list of the oxides you want to use to process it.

# create a probedata object for the data and specify oxides to analyse
oxides = ['SiO2', 'FeO', 'MgO', 'MnO', 'CaO']
Ol_probe = probedata(probe_data=Ol_raw, oxides=oxides)

Now we can process the data. For example we could calculate the cations per formula unit of each data point, given an ideal anions-per-formula-unit of four:

Ol_cations = calc_cations(probe_data=Ol_probe, afu=4.)

The above line returns a pandas DataFrame containing the cations per formula unit from the raw data in wt% oxides. This could be saved as another excel spreadsheet or used in further calculations.

The code is written in such a way that it doesn't know what mineral is being input, so we could calculate the cations per formula unit for any given number of anions per formula unit. This makes it applicable to analyses of any mineral, given we have a constraint on the structure of the mineral's unit lattice.

Suggestions

If you have ideas for functionality that you would like to see, or bugs and errors you have found, please add them by opening an issue. Or drop me an email at [email protected]

probedatatools's People

Contributors

fboschetty avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.