orsopy.slddb.webapi module

class orsopy.slddb.webapi.SLD_API[source]

Bases: object

Python API for users of the SLDDB data.

Allows to query the online database for materials, calculate SLDs and add new materials. If connection to the server fails, a local copy of the database is used, instead.

Usage:

from orsopy.slddb import api res=api.search(formula=”Fe2O3”) res[0][‘density’] => ….

m=api.material(res[0][‘ID’]) # retrieve all data for the given material, see Material class. sldn=m.rho_n # get nuclear neutron SLD (complex number) sldm=m.rho_m # get magnetic neutron SLD (real number) sldx=m.f_of_E(E=8.047823) # get x-ray SLD (complex number) for given energy, default is Cu-Kalpha

# custom material just for SLD calculation, requires either dens, fu_volume, rho_n or xsld+xE m=api.custom(formula=’Au’, dens=19.3)

Units of results/queries:

density: g/cm³ roh_n: Å^{-2} roh_m: Å^{-2} sldx: Å^{-2} fu_volume: ų

db_suburl = 'download_db'
max_age = 1
db: SLDDB = None
check()[source]
download_db()[source]
static webquery(qdict)[source]
localquery(qdict)[source]
localmaterial(ID)[source]
search(**opts)[source]

Search for a particular material using a combination of provided search keys.

Examples:

api.search(formula=”Fe2O3”) api.search(density=5.242) api.search(name=’iron’)

material(ID)[source]

Returns the material object for a certain database entry specified by its unique ID.

Example:

res=api.search(formula=’Fe’) material=api.material(res[0][‘ID’]) print(material.dens, material.rho_n, material.f_of_E(8.0))

static custom(formula, dens=None, fu_volume=None, rho_n=None, mu=0.0, xsld=None, xE=None)[source]

Returns the material object for a certain material as specified by caller.

Example:

res=api.custom(‘Fe’, dens=7.8) print(material.dens, material.rho_n, material.f_of_E(8.0))

bio_blender(sequence, molecule='protein')[source]

Get material for protein, DNA or RNA. Provide a letter sequence and molecule type (‘protein’, ‘dna’, ‘rna’).