How to use o2sclpy - 2 common examples

To help you get started, we’ve selected a few o2sclpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awsteiner / o2scl / examples / plot / old / ex_nucmass_plot.py View on Github external
"""
Plot data from ex_nucmass
"""

import numpy as np
import matplotlib.pyplot as plot
import o2sclpy
import math

gc=o2sclpy.plotter()
gc.read('../ex_nucmass_table.o2')
gc.canvas_flag=1

Zgrid=range(1,121)
Ngrid=range(1,181)
sl=np.zeros(shape=(120,180))

labels=['Semi-empirical',
        'Moller et al. (1995)',
        'HFB 14',
        'HFB 21',
        'HFB 27',
        'AME (2003)',
        'Duflo and Zuker (1996)',
        'Koura et al. (2005)',
        'Dieperink et al. (2009)',
github awsteiner / o2scl / examples / plot / old / ex_nucmass_plot.py View on Github external
'HFB 14',
        'HFB 21',
        'HFB 27',
        'AME (2003)',
        'Duflo and Zuker (1996)',
        'Koura et al. (2005)',
        'Dieperink et al. (2009)',
        'Wang et al. (2010)',
        'Liu et al. (2011)']

names=['se','mnmsk','hfb14','hfb21','hfb27','ame03','dz96',
       'ktuy05','dvi','ws32','ws36']

for i in range(0,11):

    (fig,ax)=o2sclpy.default_plot()

    # First initialize slice to zero
    for N in range(0,180):
        for Z in range(0,120):
            sl[Z,N]=0
    # Now fill with data
    print('name:',names[i],'nlines:',gc.dset['nlines'][0])
    for row in range(0,gc.dset['nlines'][0]):
        if gc.dset['data/N'][row]>7:
            if gc.dset['data/Z'][row]>7:
                val=gc.dset['data/'+names[i]][row]
                sl[int(gc.dset['data/Z'][row]-0.99),
                   int(gc.dset['data/N'][row]-0.99)]=val
    # Now plot
    cax=plot.imshow(sl,interpolation='nearest',origin='lower',
                extent=[1,180,1,120],aspect='auto',cmap='PuOr')

o2sclpy

Python extensions for O2scl

GPL-3.0
Latest version published 10 months ago

Package Health Score

44 / 100
Full package analysis

Popular o2sclpy functions

Similar packages