Package: baroncs
Table of ContentsTable of ContentsbaroncsInstallationUsageCharge state distributionDataframeMean charge state and standard deviationSourcesbaroncsThis package is based on Baron's corrected formula [^1]. It calculates the charge state distribution of ions in a gas target.InstallationTo install the package, run the following command in the terminal:pipinstallbaroncsFor developer installation, run the following command in the terminal:gitclonehttps://github.com/jako4295/baroncs.git
pipinstall-ebaroncsUsageCharge state distributionBy default the charge state distribution is usinge0=931.5andenergy=4.2to 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:importbaroncsasbcscharge_obj=bcs.ChargeState()distx,disty=charge_obj.charge_state_distribution(atomic_nr=82,# atomic number of the projectileenergy=4.2,# energy of the projectile in MeV/ue0=931.5,# rest energy in MeVdist_onesided_len=5,# length of the on each side of the mean charge stateplot=True,# plot the distribution)This returns the following plot:To calculate the charge state distribution given a beta factor, run the following python code:importbaroncsasbcscharge_obj=bcs.ChargeState()distx,disty=charge_obj.charge_state_distribution(atomic_nr=82,# atomic number of the projectilebeta=0.09,# beta factordist_onesided_len=5,# length of the on each side of the mean charge stateplot=True,# plot the distribution)This returns the following plot:If the distdist_onesided_lenis changed then we get the following:distx,disty=charge_obj.charge_state_distribution(atomic_nr=82,# atomic number of the projectileenergy=4.2,# energy of the projectile in MeV/ue0=931.5,# rest energy in MeVdist_onesided_len=10,# length of the on each side of the mean charge stateplot=True,# plot the distribution)If it is desired to create the plot in a different way thendistxanddistycorresponds to the x and y values of theplt.barfunction.DataframeTo create a dataframe with information about each atomic number, run the following python code:importbaroncsasbcscharge_obj=bcs.ChargeState()df=charge_obj.dataframe()# this uses default e0=931.5, energy=4.2The dataframe has the following columns:Name: atomic number of the projectile (this is the index of the dataframe)Atomic Number: atomic number of the projectileCommonest Isotope: the most common isotope of the projectileAbundance (%): the abundance of the most common isotopeMelting Point: the melting point of the projectileNearest Q (A/Q=8): the nearest charge state to A/Q=8Actual Q/A: the actual charge state of the projectileA/Q: the A/Q of the projectileMean Charge: the mean charge state of the projectileMost Probable: the most probable charge state of the projectileStandard Deviation: the standard deviation of the charge state distributionProbable %: the probability of the most probable charge stateMagnetic Rigidity: the magnetic rigidity of the projectileIf it is not desired to get all atoms, then we can specify which atoms to get by using theatomsargument:importbaroncsasbcscharge_obj=bcs.ChargeState()df=charge_obj.dataframe(atoms=[54,82])# this uses default e0=931.5, energy=4.2This will only return the dataframe for Xenon and Lead (atomic number 54 and 82 respectively).Mean charge state and standard deviationBoth the mean charge state and the standard deviation uses the relativistic beta factor. Ifcharge_obj.charge_state_distributionis called then the relativistic beta function is calculated and stored incharge_obj.beta(this is the one that will be used ifcharge_obj.mean_charge_stateorcharge_obj.std_charge_stateis 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 usinge0andenergy, or specifying the beta factor directly. These examples are shown below:Usinge0andenergyimportbaroncsasbcscharge_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)Specifyingbetadirectlyimportbaroncsasbcscharge_obj=bcs.ChargeState()charge_obj.beta=0.09# set the beta factor directlymean_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