Skip to main content

Calculating opacities

Project description

Readme file

Implementations and versions

  • Implementations in the current version (Beta 0.1):
    • Grain shapes: Implemented CDE grains
    • Grain sizes: single grain size
    • Optical constants in database: olivine (amorph and crystalline), carbon, ices
    • Benchmarked with Michiels code (Min et al 2009)
  • Next version (Beta 1.0)
    • Grain shapes: implement MIE and CDE grains
    • Grain sizes: single grain size
    • Optical constants in database:
      • silicates (olivine and pyroxene, amorph and crystalline)
      • oxides
      • carbon
      • ices
      • Able to use your own optical constants
  • Future versions:
    • Grain shapes: implement MIE, DHS, GRF and CDE grains
    • Grain sizes: single grain size and grain size distributions
    • Optical constants in database:
      • Full JENA database avaliable in the SQLite database
      • Able to use your own optical constants
    • Other functions:
      • Enable saving of the opacities in a local SQLite DB


  • PyPi:
    run: pip install opacity_calculator
  • Github
    • Download the files from github. Inside the opacity_calculator directory type (if you need permissions, with sudo): python install
    • To test if it works type python to go into python and then “import opacity_calculator”



Getting started: an example

If you have the opacity_calculator installed and want to test how it works and plot a spectrum with the matplotlib package. Go into python and type:
  • import opacity_calculator as oc
  • opacitiesForsterite = oc.getOpacity(“fo050”, 1.0, print_console_output = True)
  • import matplotlib.pyplot as plt
  • plt.plot(opac.getX(), opac.getY())
If you want to try another mineral, check the content of the database in the following way:
  • import opacity_calculator as oc
  • oc.printDatabase()
  • You can use the labels in the label column to generate opacities with the getOpacity function.

General code structure and classes

Classes & Files

  • Package and python scripts
  • DataClasses:
  • Calculators
  • Database files:

Databases and table structure

  • Filename: SQLITE_DATABASE.db
  • Table: OpticalConstantsTable

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
opacity_calculator-0.1.tar.gz (6.2 MB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page