Skip to content

Conversation

@drix00
Copy link
Member

@drix00 drix00 commented May 1, 2020

This pull request allow to get transitions for light elements when no probability are available in the database, but a relative weight is available using element_xray_transitions. See commit 3021322.

The implementation is not great. I was not able to combine table_probability and table_relative_weight in one SQL operation, the SQL query did not work. So the implementation duplicates the SQL query for table_probability, but using table_relative_weight if the number of transitions found with table_probability is zero.

The print_element_xray_transitions is also modified to output the relative weight of each transition.

A test was added to test the new functionality of element_xray_transitions and tests pass.

What I try and it did not work was to add a join for table_relative_weight and modify the clause table_probability.c['value'] > 0.0 to use a sqlalchemy.or_ on both. Various was tried and either the SQL gives an error or the number of transitions was too large (>1000).

Thanks,
Hendrix

drix00 added 2 commits April 30, 2020 18:49
Print relative weight with print_element_xray_transitions.
Get transitions for non zero relative weight in element_xray_transitions even if probability is zero.
This to get x-ray transition for lights element like Li.
Implement a naive implementation, it could be improved.
@drix00 drix00 self-assigned this May 1, 2020
@codecov
Copy link

codecov bot commented May 1, 2020

Codecov Report

Merging #19 into master will decrease coverage by 0.23%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #19      +/-   ##
==========================================
- Coverage   94.01%   93.78%   -0.24%     
==========================================
  Files          39       39              
  Lines        2908     2945      +37     
==========================================
+ Hits         2734     2762      +28     
- Misses        174      183       +9     
Impacted Files Coverage Δ
pyxray/base.py 66.96% <0.00%> (-2.49%) ⬇️
pyxray/sql/data.py 97.54% <100.00%> (+0.17%) ⬆️
tests/sql/test_data.py 96.29% <100.00%> (-3.71%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d4f8f2...33c8694. Read the comment docs.

@ppinard
Copy link
Member

ppinard commented May 10, 2020

I also had a try to create a single SQL query but I don't think it is possible without using SELECT DISTINCT or UNION, which are not really any better than searching for the probability first and then the relative weight.

@ppinard ppinard merged commit 6f2c10c into master May 10, 2020
@drix00 drix00 deleted the lithium branch May 11, 2020 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants