Acquire Metal Composition Data for Chemisorption

The call to obtain information about active metals in a chemisorption sample is mic.metal_composition. Specifically, this call provides access to the data shown in the table of the Active Metals window. With no arguments specified, the call returns a list of all the active metals in the sample. When called with a metal specified, the method returns an associative array (python dictionary) of the metal's properties. With both the metal and property specified, the call returns the value for the specified metal property. The following example script illustrates these three usage patterns.

Copy
import mic
import pprint as pp

# Without any arguments, the method returns a list of the active metals in
# the sample.
mnames = sorted(mic.metal_composition())
mic.summary("Metal Composition: " + pp.pformat(mnames))

# With only the 'metal' argument, the method returns a dictionary of the
# specified metals' properties.
mprops = sorted(mic.metal_composition(mnames[0]).items())
mkeys = []
mvals = []
for k, v in mprops:
    units = ''
    if 'atomic weight' in k:
        units = ' amu'
    elif 'cross sectional area' in k:
        units = ' nm²'
    elif 'density' in k:
        units = ' g/cm³'
    elif 'percent of sample mass' in k or 'percent reduced' in k:
        units = '%'
    mkeys.append(k + ':')
    mvals.append('{:8.3f}'.format(v) + units)
mic.summary.add("Properties for " + mnames[0], mkeys, mvals)

# With both first two arguments the method returns a single value for the
# specified property.
mweights = []
for mname in mnames:
    mweights.append('{:8.3f}'.format(mic.metal_composition(mname, 'atomic weight')))
mic.summary.add("Active Metals and Atomic Weight (amu)", mnames, mweights)