Nanoindentation Library

Classes to evaluate indentation data and indenter tip

  • Methods: iso, multiple unloading segments, csm

  • Vendor: Agilent, Hysitron, FischerScope, Micromaterials

  • Indenter tip: shape of indenter tip and gantry stiffness (that what you calibrate)

UNITS: one should use mSI units in this code, since Agilent area function is unit-dependent
[mN], [um], [GPa] (force, length, stress)

Variables: differentiate different length

  • array of full length: force, time, depth, validMask, … [used for plotting]

  • array of valid length: E,H,Ac,hc, … [only has the length where these values are valid]

  • force[validMask] = pMax

  • all these are vectors: OliverPharr et al methods are only vector functions

Coding rules:

  • Change all variables: do not keep original-depth as can be reread and makes code less readable

class micromechanics.indentation.Indentation(fileName=None, nuMat=0.3, tip=None, surface={}, model={}, output={})

Bases: object

Main class of indentation

OliverPharrMethod(stiffness, pMax, h, nonMetal=1.0)

Conventional Oliver-Pharr indentation method to calculate reduced Modulus modulusRed

The following equations are used in that order:

  • hc = h-beta pMax/stiffness

  • Ac = hc(prefactors)

  • stiffness = 2/sqrt(pi) sqrt(Ac) modulusRed

  • Ac the contact area, hc the contact depth

Parameters:
  • stiffness (float) – stiffness = slope dP/dh

  • pMax (float) – maximal force

  • h (float) – total penetration depth

  • nonMetal (float) – ability to change between metal=0 and nonMetal=1

Returns:

modulusRed, Ac, hc

Return type:

list

ReducedModulus(modulus, nuThis=-1)

Calculate the reduced modulus from the Youngs modulus

Parameters:
  • modulus (float) – Youngs modulus [GPa]

  • nuThis (float) – use a non-standard Young’s modulus

Returns:

Reduced Young’s modulus

Return type:

float

YoungsModulus(modulusRed, nuThis=-1)

Calculate the Youngs modulus from the reduced Youngs modulus

Parameters:
  • modulusRed (float) – reduced Youngs modulus [GPa]

  • nuThis (float) – use a non-standard Poission’s ratio

Returns:

Young’s modulus

Return type:

float

__init__(fileName=None, nuMat=0.3, tip=None, surface={}, model={}, output={})

Initialize indentation experiment data

Parameters:
  • fileName (str) – fileName to open (.xls, .hld)

  • nuMat (float) – material’s Poisson ratio.

  • tip (tip) – tip class to use; None=perfect

  • surface (dict) – dictionary describing the surface find

  • model (dict) – numerical parameters that determine the evaluation

  • output (dict) – links that descripe the output (graphs and print-to-screen)

analyse()

update slopes/stiffness, Young’s modulus and hardness after displacement correction by:

  • drift correction

  • compliance change

ONLY DO ONCE AFTER LOADING FILE: if this causes issues introduce flag analysed

which is toggled during loading and analysing

analyseDrift(plot=True, fraction=None, timeStart=None, duration=-1)

Analyse drift segment by:

  • Hysitron before the test

  • Micromaterials after the test

Parameters:
  • plot – plot drift data

  • fraction – fraction of data used for fitting (Micromaterials uses last 0.6)

  • timeStart – initial timestamp used for drift analysis; e.g. after 20sec; this superseeds fraction

  • duration – duration of drift

Results:

drift in um/s

calcHardness(minDepth=-1, plot=False)

Calculate and plot Hardness as a function of the depth

Parameters:
  • minDepth (float) – minimum depth for fitting horizontal; if negative: no line is fitted

  • plot (bool) – plot comparison this calculation to data read from file

calcStiffness2Force(minDepth=0.01, plot=True, calibrate=False)

Calculate and plot stiffness squared over force as a function of the depth

Parameters:
  • minDepth (float) – minimum depth for fitting line

  • plot (bool) – plot curve and slope

  • calibrate (bool) – calibrate additional stiffness and save value

Returns:

prefactors

Return type:

list

calcYoungsModulus(minDepth=-1, plot=False)

Calculate and plot Young’s modulus as a function of the depth
use corrected h and stiffness (do not recalculate)

Parameters:
  • minDepth (float) – minimum depth for fitting horizontal; if negative: no line is fitted

  • plot (bool) – plot comparison this calculation to data read from file

Returns:

average Young’s modulus, minDepth>0

Return type:

float

calibrateStiffness(critDepth=0.5, critForce=0.0001, plotStiffness=True, returnData=False)

Calibrate by first frame-stiffness from K^2/P of individual measurement

Parameters:
  • critDepth (float) – frame stiffness: what is the minimum depth of data used

  • critForce (float) – frame stiffness: what is the minimum force used for fitting

  • plotStiffness (bool) – plot stiffness graph with compliance

  • returnData (bool) – return data for external plotting

Returns:

data as chosen by arguments

Return type:

numpy.arary

calibration(eTarget=72.0, numPolynomial=3, critDepthStiffness=1.0, critForce=1.0, critDepthTip=0.0, plotStiffness=False, plotTip=False, **kwargs)

Calibrate by first frame-stiffness and then area-function calibration

Parameters:
  • eTarget (float) – target Young’s modulus (not reduced), nu is known

  • numPolynomial (int) – number of area function polynomial; if None: return interpolation function

  • critDepthStiffness (float) – what is the minimum depth of data used

  • critDepthTip (float) – area function what is the minimum depth of data used

  • critForce (float) – frame stiffness: what is the minimum force used for fitting

  • plotStiffness (bool) – plot stiffness graph with compliance

  • plotTip (bool) – plot tip shape after fitting

  • **kwargs (dict) –

    additional keyword arguments

    • constantTerm (bool): add constant term into area function

    • returnArea (bool): return contact depth and area

Returns:

success

Return type:

bool

correctThermalDrift()

not perfectly implemented

fillVendorDefaults()

fill defaults depending on vendor, if information is not yet present

hertzFit(forceRange=(1, 25), correctH=True, plot=True)

Fit the initial force displacement curve to the Hertzian curve

Parameters:
  • forceRange (list) – force range used for fitting in mN

  • correctH (bool) – correct the depth

  • plot (bool) – plot the result

Returns:

parameters determined by fitting

Return type:

list

identifyLoadHoldUnload(plot=False)

internal method: identify ALL load - hold - unload segments in data

Parameters:

plot (bool) – verify by plotting

Returns:

success of identifying the load-hold-unload

Return type:

bool

identifyLoadHoldUnloadCSM(plot=False)

internal method: identify load - hold - unload segment in CSM data
Backup: if identifyLoadHoldUnload fails

Parameters:

plot (bool) – plot values

Returns:

success of identifying hold-load-unload sequence

Return type:

bool

inverseOliverPharrMethod(stiffness, pMax, modulusRed, nonMetal=1.0)

Inverse Oliver-Pharr indentation method to calculate contact area Ac

  • equations and variable definitions given above; order in reverse order

  • only used for verification of the Oliver-Pharr Method

Parameters:
  • stiffness (float) – slope dP/dh at the maximum load pMax

  • pMax (float) – maximal force

  • modulusRed (float) – modulusRed

  • nonMetal (float) – ability to change between metal=0 and nonMetal=1

Returns:

h penetration depth

Return type:

float

loadAgilent(fileName)

Initialize G200 excel file for processing

Parameters:

fileName (str) – file name

Returns:

success

Return type:

bool

loadFischerScope(fileName)

Initialize txt-file from Fischer-Scope for processing

Parameters:

fileName (str) – file name

Returns:

success

Return type:

bool

loadHDF5(fileName)

Initialize hdf5-file that all converters are producing

Parameters:

fileName (str) – file name

Returns:

success

Return type:

bool

loadHysitron(fileName, plotContact=False)

Load Hysitron hld or txt file for processing, only contains one test

Parameters:
  • fileName (str) – file name

  • plotContact (bool) – plot intial contact identification (use this method for access)

Returns:

success

Return type:

bool

loadMicromaterials(fileName)

Load Micromaterials txt/zip file for processing, contains only one test

Parameters:

fileName (str) – file name or file-content

Returns:

success

Return type:

bool

nextAgilentTest(newTest=True)

Go to next sheet in worksheet and prepare indentation data

Data:

  • _Raw: without frame stiffness correction,

  • _Frame: with frame stiffness correction (remove postscript finally)

  • only affects/applies directly depth (h) and stiffness (s)

  • modulus, hardness and k2p always only use the one with frame correction

Parameters:

newTest (bool) – take next sheet (default)

Returns:

success of going to next sheet

Return type:

bool

nextFischerScopeTest()

Go to next test

Returns:

success

Return type:

bool

nextHDF5Test()

Go to next branch in HDF5 file - TODO check for non CSM

Returns:

success

Return type:

bool

nextMicromaterialsTest()

Go to next file in zip or hdf5-file

Returns:

success of going to next sheet

Return type:

bool

nextTest(newTest=True, plotSurface=False)

Wrapper for all next test for all vendors

Parameters:
  • newTest (bool) – go to next test; false=redo this one

  • plotSurface (bool) – plot surface area

Returns:

success of going to next sheet

Return type:

bool

plot(saveFig=False, show=True, plotAllItems=True)

Plot force-depth curve with all data

Parameters:
  • saveFig (bool, str) – if bool, save plot to file [use known filename plus extension png]; else use fileName

  • show (bool) – show figure, else do not show

Returns:

figure

Return type:

pyplot.axis

plotAll(saveFig=False, show=True)

Plot force-depth curves of all tests in the file

Parameters:
  • saveFig (bool) – save plot to file [use known filename plus extension png]

  • show (bool) – show figure, else do not show

Returns:

figure

Return type:

pyplot.axis

plotAsDepth(entity, hvline=None, vmax=None, vmin=None)

Plot as function of depth either Young’s modulus, hardness, stiffnessSquaredForce, ContactDepth, Contact Area, reducedModulus
Makes only sense for CSM measurements

Parameters:
  • entity (str) – what to plot on y-axis [E,H,K,K2P,hc,Ac,modulusRed]

  • hvline (float) – plot a horizontal line at this value

  • vmax (float) – maximum value for plotting

  • vmin (float) – minimum value for plotting

plotTestingMethod(saveFig=False, show=True, double=False)

plot testing method

Parameters:
  • saveFig (bool) – save plot to file [use known filename plus extension png]

  • show (bool) – show figure, else do not show

  • double (bool) – show also stiffness and phase an function of time

Returns:

figure

Return type:

pyplot.axis

popIn(correctH=True, plot=True, removeInitialNM=2.0)

Search for pop-in by jump in depth rate

Certainty:

  • deltaSlope: higher is better (difference in elastic - plastic slope). Great indicator

  • prefactor: higher is better (prefactor of elastic curve). Great indicator

  • secondRate: lower is better (height of second largest jump). Nice indicator 0.25*deltaRate

  • covElast: lower is better. bad indicator

  • deltaH: higher is better (delta depth in jump). bad indicator

  • deltaRate: higher is better (depth rate during jump). bad indicator

Future: iterate over largest, to identify best

Parameters:
  • correctH (bool) – correct depth such that curves aligned

  • plot (bool) – plot pop-in curve

  • removeInitialNM (float) – remove initial nm from data as they have large scatter

Returns:

pop-in force, dictionary of certainty

Return type:

list

restartFile()

Restart processing the current file by resetting all values back to the initial

saveToUserMeta()

save results to user-metadata

stiffnessFromUnloading(p, h, plot=False)

Calculate single unloading stiffness from Unloading; see G200 manual, p7-6

Parameters:
  • p (np.array) – vector of forces

  • h (np.array) – vector of depth

  • plot (bool) – plot results

Returns:

stiffness, validMask, mask, optimalVariables, powerlawFit-success

validMask is [values of p,h where stiffness is determined]

Return type:

list

tareDepthForce(slopeThreshold=100, compareRead=False, plot=False)

Calculate surface contact (by slope being larger than threshold) and offset depth,force,time by the surface

Future improvements:

  • surface identification in future

  • handle more cases

Parameters:
  • slopeThreshold – threshold slope in P-h curve for contact: 200,300

  • compareRead – compare new results to the ones from the file

  • plot – plot comparison new data and data from file

static unloadingPowerFunc(h, B, hf, m)

internal function describing the unloading regime

  • function: p = B*(h-hf)^m

  • B: scaling factor (no physical meaning)

  • m: exponent (no physical meaning)

  • hf: final depth = depth where force becomes 0

verifyOneData()

Test one data set to ensure everything still working: OliverPharrMethod and area functions (normal and inverse)

verifyOneData1()

Test one data set to ensure everything still working: OliverPharrMethod and area functions (normal and inverse)

verifyReadCalc(plot=True)

Compare Young’s modulus data saved in the file to Young’s modulus data calculated by these functions

Parameters:

plot (bool) – plot comparison