Skip to main content

An utility package for nuclear data.

Project description

nuclyr - an utility package for nuclear physics

  1. Build
  2. Config
  3. Submodules
    1. exfor
    2. mass

Build

The package nuclyr is available via pip. See https://pypi.org/project/nuclyr/.

Just run:

pip install nuclyr

Or just clone the repository and build it from there using setup.py.

For the webscraping part of the package a driver for your favorite browser is needed, e.g. chromedriver or msedgedriver. You can find them via the following links:

Please make sure, you're downloading the right version for your browser.

Config

At start nuclyr will create a configuration file in your home directory called .nuclyr which is in JSON format. You can easily edit all the package configurations with your prefered text editor, e.g. the location of the webdriver.

The configurations can also be added within a python script via:

import nuclyr.config as cf

#Setting driver_loc to "path/to/driver"
cf.Set("driver_loc", "path/to/driver") 

#Getting the current options for the driver location
cf.Get("driver_loc") 

#print the whole configuration file
cf.Show() 

Submodules

exfor

This submodule is for mineing up-to-date reaction data from the EXFOR data base.

A simple example to mine the cross section data for 63Cu(p,n) would look like:

#import nuclyr modules
import nuclyr.config as cf
from nuclyr import exfor

#import pyplot for plotting the data
import matplotlib.pyplot as plt

#definition of target and reaction of interest
target="63Cu"
reaction="p,n"

#setting the driver location
cf.Set("driver_loc","path/to/driver")

#obtaining the data via exfor.getSig()
data, legend = exfor.getSIG(target,reaction)

#plotting the dataframes
plt.figure(1, figsize=(8,5))

plt.xlim(xmin=0, xmax=40)
plt.ylim(ymin=0, ymax=1000)
plt.xlabel("proton energy [MeV]", size=25)
plt.ylabel("cross section [mb]", size=25)
plt.text(20, 400, r"$^{63}$Cu(p,n)", size=25)
plt.gca().tick_params(labelsize=20)

for df in data:
    plt.scatter(df[('EN','MEV')], df[('DATA','MB')])

plt.tight_layout()
plt.show()

The result would look like:

.

mass

You want to use recommended values for nuclear masses in your python code? You can get them via this submodule. Here is a small example of getting the mass excesses of thin isotopes.

from nuclyr import mass
import matplotlib.pyplot as plt
import numpy as np

masses = np.arange(99,138)
excess = np.zeros(len(masses))
errors = np.zeros(len(masses))

for i in range(len(masses)):
    number[i], errors[i] =mass.massExcess(50,masses[i])


plt.figure(1, figsize=(8,5))
plt.ylabel(r"mass excess [MeV]", size=25)
plt.xlabel(r"mass number", size=25)
plt.gca().tick_params(labelsize=15)
plt.text(115, -60, r"Z=50", size=30)
plt.errorbar(masses, number, yerr=errors, color="black", marker="o", linestyle="--")
plt.tight_layout()
plt.show()

The script above will produce the following plot:

Project details


Download files

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

Source Distribution

nuclyr-0.16.tar.gz (239.0 kB view details)

Uploaded Source

Built Distribution

nuclyr-0.16-py3-none-any.whl (244.7 kB view details)

Uploaded Python 3

File details

Details for the file nuclyr-0.16.tar.gz.

File metadata

  • Download URL: nuclyr-0.16.tar.gz
  • Upload date:
  • Size: 239.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.5

File hashes

Hashes for nuclyr-0.16.tar.gz
Algorithm Hash digest
SHA256 daa3ee20c2df079c047ddb82acb6d6dcbc244931e2ec930fae6fc179758dd854
MD5 fbf1dffbcf8eee5fab454c693566289b
BLAKE2b-256 60884a06902debbb18d602ca9f31a24f8f24802463bbd8b334c7fb6a1375e7f6

See more details on using hashes here.

File details

Details for the file nuclyr-0.16-py3-none-any.whl.

File metadata

  • Download URL: nuclyr-0.16-py3-none-any.whl
  • Upload date:
  • Size: 244.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.5

File hashes

Hashes for nuclyr-0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 489a1dd32edf237f466bc9fb73dd9e68980befa87bde7389e6e8ec97677357f9
MD5 a74bf3c8118965a6c71e66b66a597406
BLAKE2b-256 495d010f7276fae4a22d1d1f217a42685c47733271ade3839b11a0e1d4326942

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page