Skip to main content

Finds the charge state distribution of a given element.

Project description

Table of Contents

baroncs

This package is based on Baron's corrected formula [^1]. It calculates the charge state distribution of ions in a gas target.

Installation

To install the package, run the following command in the terminal:

pip install baroncs

For developer installation, run the following command in the terminal:

git clone https://github.com/jako4295/baroncs.git
pip install -e baroncs

Usage

Charge state distribution

By default the charge state distribution is using e0=931.5 and energy=4.2 to calculate the relativistic beta factor. However, these energies can also be specified. The beta factor can also be specified directly. These examples are shown below:

To obtain the charge state distribution for a given atom and energy, run the following python code:

import baroncs as bcs

charge_obj = bcs.ChargeState()
distx, disty = charge_obj.charge_state_distribution(
    atomic_nr=82,  # atomic number of the projectile
    energy=4.2,  # energy of the projectile in MeV/u
    e0=931.5,  # rest energy in MeV
    dist_onesided_len=5,  # length of the on each side of the mean charge state
    plot=True,  # plot the distribution
)

This returns the following plot: Charge state distribution

To calculate the charge state distribution given a beta factor, run the following python code:

import baroncs as bcs

charge_obj = bcs.ChargeState()
distx, disty = charge_obj.charge_state_distribution(
    atomic_nr=82,  # atomic number of the projectile
    beta=0.09,  # beta factor
    dist_onesided_len=5,  # length of the on each side of the mean charge state
    plot=True,  # plot the distribution
)

This returns the following plot: Charge state distribution specified beta

If the dist dist_onesided_len is changed then we get the following:

distx, disty = charge_obj.charge_state_distribution(
    atomic_nr=82,  # atomic number of the projectile
    energy=4.2,  # energy of the projectile in MeV/u
    e0=931.5,  # rest energy in MeV
    dist_onesided_len=10,  # length of the on each side of the mean charge state
    plot=True,  # plot the distribution
)

Charge state distribution varied dist onesided len

If it is desired to create the plot in a different way then distx and disty corresponds to the x and y values of the plt.bar function.

Dataframe

To create a dataframe with information about each atomic number, run the following python code:

import baroncs as bcs

charge_obj = bcs.ChargeState()
df = charge_obj.dataframe()  # this uses default e0=931.5, energy=4.2

The dataframe has the following columns:

  • Name: atomic number of the projectile (this is the index of the dataframe)
  • Atomic Number: atomic number of the projectile
  • Commonest Isotope: the most common isotope of the projectile
  • Abundance (%): the abundance of the most common isotope
  • Melting Point: the melting point of the projectile
  • Nearest Q (A/Q=8): the nearest charge state to A/Q=8
  • Actual Q/A: the actual charge state of the projectile
  • A/Q: the A/Q of the projectile
  • Mean Charge: the mean charge state of the projectile
  • Most Probable: the most probable charge state of the projectile
  • Standard Deviation: the standard deviation of the charge state distribution
  • Probable %: the probability of the most probable charge state
  • Magnetic Rigidity: the magnetic rigidity of the projectile

If it is not desired to get all atoms, then we can specify which atoms to get by using the atoms argument:

import baroncs as bcs

charge_obj = bcs.ChargeState()
df = charge_obj.dataframe(atoms=[54, 82])  # this uses default e0=931.5, energy=4.2

This will only return the dataframe for Xenon and Lead (atomic number 54 and 82 respectively).

Mean charge state and standard deviation

Both the mean charge state and the standard deviation uses the relativistic beta factor. If charge_obj.charge_state_distribution is called then the relativistic beta function is calculated and stored in charge_obj.beta (this is the one that will be used if charge_obj.mean_charge_state or charge_obj.std_charge_state is called).

If it is desired to calculate the mean charge state and standard deviation with a different beta factor, then it can be specified either using e0 and energy, or specifying the beta factor directly. These examples are shown below: Using e0 and energy

import baroncs as bcs

charge_obj = bcs.ChargeState()
charge_obj.beta = (4.2, 931.5)  # set the beta factor (energy, e0)
mean_charge_state = charge_obj.mean_charge_state(
    atomic_nr=82,  # atomic number of the projectile
)
std_charge_state = charge_obj.std_charge_state(
    atomic_nr=82,  # atomic number of the projectile
)

Specifying beta directly

import baroncs as bcs

charge_obj = bcs.ChargeState()
charge_obj.beta = 0.09  # set the beta factor directly
mean_charge_state = charge_obj.mean_charge_state(
    atomic_nr=82,  # atomic number of the projectile
)
std_charge_state = charge_obj.std_charge_state(
    atomic_nr=82,  # atomic number of the projectile
)

Sources

[^1]: Charge exchange of very heavy ions in carbon foils and in the residual gas of GANIL cyclotrons

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

baroncs-0.1.5.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

baroncs-0.1.5-py2.py3-none-any.whl (11.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file baroncs-0.1.5.tar.gz.

File metadata

  • Download URL: baroncs-0.1.5.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for baroncs-0.1.5.tar.gz
Algorithm Hash digest
SHA256 11163f413dd3b25d23e8dd5b2a0b5dd4103da4beeecad6ec52f8b1229d6772d5
MD5 142e1bc9c30aba4606f9dd551c89c285
BLAKE2b-256 fe4513ba5864939b06222d3a04b4fa6ec2a962dad5a7da70e1c6eba511ac9946

See more details on using hashes here.

File details

Details for the file baroncs-0.1.5-py2.py3-none-any.whl.

File metadata

  • Download URL: baroncs-0.1.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for baroncs-0.1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 50cc1c54d684f2f3195a0257c3efaffb1b783a5c014b8eba93b96e49f57ef9d1
MD5 789e89e206b43bfeb2a64401b71c0dc7
BLAKE2b-256 736eb49315bbbd9b5a1c0e62f8aa6a85e57e413f83421b9db8498933022d3cd3

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