johnson-c / colradpy Goto Github PK
View Code? Open in Web Editor NEWCollisional-radiative python solver
License: Other
Collisional-radiative python solver
License: Other
collections.Mapping
does not work in python 3.9 or 3.10. Please updated README.txt to say that Python 3.8 is required to run ColRadPy
AttributeError:
File "C:\Users\dsgah\github\ColRadPy\colradpy\colradpy_class.py", line 305, in update_dict
if isinstance(v, collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'
More info on the error: https://stackoverflow.com/questions/70195545/module-collections-has-no-attribute-mapping-issue-on-macos-for-sdk-installa
I have found a number of errors across running the examples. These errors range from dividing by zeros errors, figures not loading, and missing input data.
I am iteratively going through the examples to get them to run on my machine. Hopefully, make them more agnostic to who ever is running the examples, thus making them more useful and ColRadPy more accessible.
Hey Curt, I noticed in how ColRadPy calculates PECs, i.e. when I use colradpy.write_pecs_adf15()
, that the code only recognizes excitation of ion with charge Z, recombination from ion with charge Z+1, and sometimes charge exchange.
But, I know that in spectra I'm modeling there's a few very specific but important lines that are purportedly significantly populated by collisional ionization (ground or even innershell) from the ion with charge Z-1 to the excited state of interest.
I understand that recombination/ionization in atomic data files are organized by looking at ion Z and its relation to ion Z+1, so I'm not sure how much of an effort it would be to also give ColRadPy the Z-1 atomic data file to calculate ionization PECs. Thoughts on this?
I installed with pip install git+https://github.com/johnson-c/ColRadPy.git#egg=colradpy. The following code seems to cause problems as I don't have git installed:
#get the path of the hash so people can track versions, done this way incase the user
#didn't pull with git but just zip tssssk tsssk tsssssk
base_path = os.path.dirname(os.path.abspath(file))
base_path = base_path[0:len(base_path) - 9]
git_dir = pathlib.Path(base_path) / '.git'
with (git_dir / 'HEAD').open('r') as head:
ref = head.readline().split(' ')[-1].strip()
with (git_dir / ref).open('r') as git_hash:
self.data['user']['git_hash'] = git_hash.readline().strip()
Because colradpy is not explicitly dependent on git otherwise, this seems like bad practice?
While attempting to run the ss_ion_ball_adf11.py example, I kept getting errors saying the computer was attempting to establish a rank 4 tensor that would take 3-8 GB to allocate. Parsing through read_adf11.py, I noticed that there is a check for
if( 'r' in re.split('_',re.split('/',fil)[-1])[0]):
Splitting by '/' is fine for Linux but doesn't work for windows where paths are split by '\'. I edited read_adf11.py to use pathlib and made a couple of performance/readability improvements related to checking ACD/SCD/XCD/etc status.
read_adf11.zip
I was running ss_ion_bal_adf11.py and got the following error:
Traceback (most recent call last):
File ~/anaconda3/lib/python3.11/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
exec(code, globals, locals)
File ~/Documents/au physics/colradpy/examples/ss_ion_bal_adf11.py:35
ion.solve_time_independent()#solve the ionization balance matrix in steady state
File ~/Documents/au physics/colradpy/colradpy/ionization_balance_class.py:607 in solve_time_independent
self.data['processed']['eigen_vec'] = solve_matrix_exponential_steady_state(
File ~/Documents/au physics/colradpy/colradpy/solve_matrix_exponential.py:117 in solve_matrix_exponential_steady_state
ev = eigenvectors.transpose(0,1,3,2)[index]#egienvectors sorted on eigenvals
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
I peeked into the code and determined that index is initialized as a list of inhomogenous zero arrays. I'm not sure how this ever works, perhaps this is a deprecated feature? However, I didn't write the code or spend >5 min attempting to understand what goes on, as I suspect I would need to spend >5 weeks to debug this on my own.
I did pull up an old copy of colradpy on a different machine since I changed file reading parts on another machine. Without these mods, I get the same error. This reinforces the deprecated feature narrative.
ECIP is giving back zeros for ionization if there is more than one metastable state is chosen in the ionization stage that the ion is going to.
Do you want a read_adf15
function? I understand that ColRadPy will calculate it from passed adf04s but as people keep on rewriting read_adf15
(including people that use ColRadPy) it would be useful to have this in one place. Feel free to use mine or use it as a starting place. I do use xarray
so it would add a dependency if you used it as is but that is easy to change.
https://github.com/dgahle/baysar/blob/feature/inter-baysar-cuda/adas/python/read_adf15.py
In the code section corresponding to plotting the populating fraction from the ground versus temperature in the file populating_lvls_example.py
, there appears to be a misunderstanding regarding the definition of level 1
.
If I correctly understand, the index should be, be.data['processed']['pop_lvl'][1,1,0,:,0]/np.sum(be.data['processed']['pop_lvl'][ 1,:,0,:,0], axis=0))
instead of be.data['processed']['pop_lvl][10,10,0,:,0]/np.sum(be.data['processed']['pop_lvl'][10,:,0,:,0], axis=0))
.
I believe the latter refers to level number 10
instead of level number 1
. I might be wrong in understanding.
A clarification on this is needed.
Hello,
I am trying to run ionization balance (time-independent with metastable states) from file provided in example/ion_bal.py.
but I am receiving the following error
**../colradpy/colradpy_class.py:1094: RuntimeWarning: divide by zero encountered in double_scalars
I running with python3.6 as suggested.
I am able to run the ionization balance using ADF11 files with only ground state.
and i using the same ADS4 files as given in example.
Please suggest what could be the reson?
Actually, I have fine structure resolved ionization and reconbination rates, finally I want to use those as input in this code.
There is a difference between curt_working and master_branch for ['wave_air'] when uses iterators that was causing a crash. [i][0] worked for master branch but caused curt_working to crash.
Hello All,
There is oprtion in AD04 where it takes non maxweelian rates. for eaxample
Ba+ 9 56 10 1166600.0(1S) 1783696.48(3D) 1949485.63(3H)
1 5s1 (2)0( 0.5) 0.00 {1}1.000 {2}1.000 {3}1.000
2 5p1 (2)1( 0.5) 137266.46 {1}1.000
3 5p1 (2)1( 1.5) 163685.60 {1}1.000
4 4f1 (2)3( 2.5) 220657.77 {1}1.000
5 4f1 (2)3( 3.5) 221857.68 {1}1.000
9.0 4 1.16+06 1.22+06 1.27+06 1.30+06 1.33+06 1.36+06 1.39+06 1.42+06 1.45+06 1.48+06 1.51+06 1.54+06 1.57+06 1.62+06
3 1 1.18+08 3.77-09 3.71-09 3.65-09 3.63-09 3.60-09 3.57-09 3.55-09 3.53-09 3.50-09 3.48-09 3.46-09 3.44-09 3.42-09 3.38-09
4 1 7.13-01 1.70-10 1.58-10 1.46-10 1.41-10 1.36-10 1.32-10 1.27-10 1.23-10 1.19-10 1.15-10 1.11-10 1.08-10 1.04-10 9.82-11
5 1 1.44+10 9.05-08 8.93-08 8.82-08 8.76-08 8.71-08 8.66-08 8.61-08 8.57-08 8.52-08 8.48-08 8.43-08 8.40-08 8.35-08 8.27-08
Here in the first line of the excitation data array
I have run the time independent ionization balance, I have given the rate at temperature grid at which I want to calulate abundance. however, It is giving
""
"Atleast one user temp point above last calculated temperature using extrapolation be carefull" and using tully rates.
"""
My querry is , I want to use exciation rate coefficients (cm3/s) and I am giving rates at the temp where I need abundance (here 100 to 150eV, yes while giving input I have converted eV to K) as CR matrix will need rate at which temp we want solution.
However, is seems grid is inappropriate as I think It is not taking as rate but collisional stength so calculationg rate it need collision stregth at various temperature.
Is it possible to give direct rate coefficients for excitation also, as we are giving for ionization and recombination.?
Thank you
As you say adf04 isn't a special file type so I propose adding an option to use FAC atomic data in ColRadPy
FAC promises it can do everything. In particular, I'm paying attention to knowing how to make:
The FAC documentation seems suggest it can't do three-body recombination. Currently, I've been using a FAC-function that automatically convolutes cross-sections with a Maxwellian but can do an option for something more general.
I know how to read the FAC data files so I propose to do this.
Is there any hiccups you'd foresee? For the rate coefficients, I'd be giving it a function of Te in units [cm3/s]. Looking at the structure of colradpy.data['rates']
I'm not actually sure how to incorporate the autoionization rates. I'd guess I can just sum the spontaneous emission and 2-photon emission rates hopefully being aware of the different broadening.
FAC also gives cross-section data so I propose also including an electron energy distribution function (EEDF) convolution function in the event you didn't use FAC's tools to convolute a Maxwellian vs. Te. I'd guess it'd be reasonable to assume anyone interested in using this functionality know how to set the cross-section energy grid in FAC themselves so it can be assumed the given cross-section data is sufficient for the desired EEDF.
Thoughts on this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.