Check if a model is inside the reference band

2.8. Check if a model is inside the reference band#

In this tutorial, you will learn how to employ nucleardatapy to check if a model is inside the reference band.


Import the libraries that will be employed in this tutorial.

# Import numpy
import numpy as np
# Import matplotlib
import matplotlib.pyplot as plt
# Import nucleardatapy package
import nucleardatapy as nuda

You can simply print out the properties of the nuda’s function that we will use:

# Explore the nucleardatapy module to find the correct attribute
print(dir(nuda.matter.setupCheck))
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'print_outputs']

Define a reference band: For instance the energy per particle in NM can be selected by fixing the variable matter = ‘NM’ in the class nuda.matter.setupMicroBand()

den = np.array([0.06,0.08,0.1,0.12,0.14,0.16])
models = [ '2016-MBPT-AM', '2016-QMC-NM', '2020-MBPT-AM' ]
band = nuda.matter.setupMicroBand( models, den=den, matter='NM' )
Band in NM
model ->  2016-MBPT-AM
flag_nm: True
flag_sm: True
flag_kf: False
flag_den: True
model ->  2016-QMC-NM
flag_nm: True
flag_sm: False
flag_kf: True
flag_den: False
model ->  2020-MBPT-AM
flag_nm: True
flag_sm: True
flag_kf: False
flag_den: True
model ->  2016-MBPT-AM
flag_nm: True
flag_sm: True
flag_kf: False
flag_den: True
model ->  2016-QMC-NM
flag_nm: True
flag_sm: False
flag_kf: True
flag_den: False
model ->  2020-MBPT-AM
flag_nm: True
flag_sm: True
flag_kf: False
flag_den: True

Choose a given microscopic model and instantiate the object micro with the model

model = '1998-VAR-AM-APR'
micro = nuda.matter.setupMicro( model = model )
model ->  1998-VAR-AM-APR
flag_nm: True
flag_sm: True
flag_kf: False
flag_den: True

Check if the microscopic model is inside the reference band in NM:

check = nuda.matter.setupCheck( eos = micro, band = band )
print('eos inside band?',check.isInside)
print('eos outside band?',check.isOutside)
eos inside band? True
eos outside band? False

Alternatively, choose a given phenomenological model and instantiate the object pheno with the model

model = 'Skyrme'
param = 'SLy5'
pheno = nuda.matter.setupPheno( model = model, param = param )
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[6], line 3
      1 model = 'Skyrme'
      2 param = 'SLy5'
----> 3 pheno = nuda.matter.setupPheno( model = model, param = param )

File ~/work/nucleardatapy/nucleardatapy/version-1.0/nucleardatapy/matter/setup_pheno.py:161, in setupPheno.__init__(self, model, param)
    159 #: Attribute providing additional notes about the data.
    160 self.note = "write here notes about this EOS."
--> 161 self.sm_den, self.sm_kfn, self.sm_e2a_int, self.sm_pre, a, self.sm_cs2 = np.loadtxt( file_in1, usecols=(0,1,2,3,4,5), comments='#', unpack = True )
    162 self.nm_den, self.nm_kfn, self.nm_e2a_int, self.nm_pre, a, self.nm_cs2 = np.loadtxt( file_in2, usecols=(0,1,2,3,4,5), comments='#', unpack = True )
    163 self.sm_e2a = self.sm_rmass + self.sm_e2a_int

File /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/numpy/lib/_npyio_impl.py:1397, in loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols, unpack, ndmin, encoding, max_rows, quotechar, like)
   1394 if isinstance(delimiter, bytes):
   1395     delimiter = delimiter.decode('latin1')
-> 1397 arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
   1398             converters=converters, skiplines=skiprows, usecols=usecols,
   1399             unpack=unpack, ndmin=ndmin, encoding=encoding,
   1400             max_rows=max_rows, quote=quotechar)
   1402 return arr

File /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/numpy/lib/_npyio_impl.py:1024, in _read(fname, delimiter, comment, quote, imaginary_unit, usecols, skiplines, max_rows, converters, ndmin, unpack, dtype, encoding)
   1022     fname = os.fspath(fname)
   1023 if isinstance(fname, str):
-> 1024     fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
   1025     if encoding is None:
   1026         encoding = getattr(fh, 'encoding', 'latin1')

File /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/numpy/lib/_datasource.py:192, in open(path, mode, destpath, encoding, newline)
    155 """
    156 Open `path` with `mode` and return the file object.
    157 
   (...)    188 
    189 """
    191 ds = DataSource(destpath)
--> 192 return ds.open(path, mode, encoding=encoding, newline=newline)

File /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/numpy/lib/_datasource.py:529, in DataSource.open(self, path, mode, encoding, newline)
    526     return _file_openers[ext](found, mode=mode,
    527                               encoding=encoding, newline=newline)
    528 else:
--> 529     raise FileNotFoundError(f"{path} not found.")

FileNotFoundError: /home/runner/work/nucleardatapy/nucleardatapy/version-1.0/nucleardatapy/data/matter/pheno/Skyrme/SLy5-SM.dat not found.

Check if the phenomenological model is inside the reference band in NM:

check = nuda.matter.setupCheck( eos = pheno, band = band )
print('eos inside band?',check.isInside)
print('eos outside band?',check.isOutside)
eos inside band? False
eos outside band? True

Plots: to be done