Skip to content

Commit

Permalink
Moving of symbols and molecular calculation (#61)
Browse files Browse the repository at this point in the history
* Reorganize import and lists

* Update to break on Travis

* Create help text string from helpTextPython39

* Reorganize test
Update to replace \r in travis specific string

* Update all cmd help tests

* Add print statement for temporary debugging

* Update help texts

* Update test to (hopefully) remove error for windows 10 + pyhton3.9

* Catch typo

* Add print for debut...

* Update help string

* Restrict matplotlib to version <3.4
Add python 3.9 to classifiers

* Update version
  • Loading branch information
Jakob-Lass committed Apr 13, 2021
1 parent a3e7e9b commit 199caa8
Show file tree
Hide file tree
Showing 29 changed files with 118 additions and 154 deletions.
2 changes: 1 addition & 1 deletion MJOLNIR/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys,os
sys.path.append('.')

__version__ = '1.1.17'
__version__ = '1.1.18'
__author__ = 'Jakob Lass'

__multiFLEXXNormalization__ = os.path.join(os.path.dirname(__file__),'CalibrationMultiFLEXX.csv')
Expand Down
81 changes: 41 additions & 40 deletions MJOLNIR/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import inspect
import matplotlib
import regex as re

# E = hbar^2k^2/(2m)
m = 1.67492749804e-27 # kg
Expand Down Expand Up @@ -827,6 +828,45 @@ def generateLabelDirection(vec,labels=['H','K','L']):
returnLabel = ''.join(['(',', '.join([x for x in label]),')'])
return returnLabel


symbols = (
'H', 'D', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al',
'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe',
'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr',
'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn',
'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm',
'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W',
'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn',
'Fr', 'Ra', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf',
'Es', 'Fm', 'Md', 'No', 'Lr', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds',
'Rg', 'Cn', 'Uut', 'Fl', 'Uup', 'Lv', 'Uus', 'Uuo'
)



# Molar mass of natural compund
_relative_atomic_masses = (
"1.008 2.0(1) 4.002602(2) 6.94 9.0121831(5) 10.81 12.011 14.007 15.999"
" 18.998403163(6) 20.1797(6) 22.98976928(2) 24.305 26.9815385(7) 28.085"
" 30.973761998(5) 32.06 35.45 39.948(1) 39.0983(1) 40.078(4)"
" 44.955908(5) 47.867(1) 50.9415(1) 51.9961(6) 54.938044(3) 55.845(2)"
" 58.933194(4) 58.6934(4) 63.546(3) 65.38(2) 69.723(1) 72.630(8)"
" 74.921595(6) 78.971(8) 79.904 83.798(2) 85.4678(3) 87.62(1)"
" 88.90584(2) 91.224(2) 92.90637(2) 95.95(1) [98] 101.07(2) 102.90550(2)"
" 106.42(1) 107.8682(2) 112.414(4) 114.818(1) 118.710(7) 121.760(1)"
" 127.60(3) 126.90447(3) 131.293(6) 132.90545196(6) 137.327(7)"
" 138.90547(7) 140.116(1) 140.90766(2) 144.242(3) [145] 150.36(2)"
" 151.964(1) 157.25(3) 158.92535(2) 162.500(1) 164.93033(2) 167.259(3)"
" 168.93422(2) 173.045(10) 174.9668(1) 178.49(2) 180.94788(2) 183.84(1)"
" 186.207(1) 190.23(3) 192.217(3) 195.084(9) 196.966569(5) 200.592(3)"
" 204.38 207.2(1) 208.98040(1) [209] [210] [222] [223] [226] [227]"
" 232.0377(4) 231.03588(2) 238.02891(3) [237] [244] [243] [247] [247]"
" [251] [252] [257] [258] [259] [266] [267] [268] [269] [270] [269]"
" [278] [281] [282] [285] [286] [289] [289] [293] [294] [294]"
)



def calculateMolarMass(sampleChemicalFormula,formulaUnitsPerUnitCell=1,returnElements=False):
"""Calculate Molar mass given chemical formula and number of formula units per cell
Expand Down Expand Up @@ -857,46 +897,7 @@ def calculateMolarMass(sampleChemicalFormula,formulaUnitsPerUnitCell=1,returnEle
stop = sampleChemicalFormula.count(')')
if not start==stop:
raise AttributeError('The number of starting and closing parenthesis do not match. Got {} "(" and {} ")"'.format(start,stop))

# Definition of chemical symbols
symbols = (
'H', 'D', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al',
'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe',
'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr',
'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn',
'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm',
'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W',
'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn',
'Fr', 'Ra', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf',
'Es', 'Fm', 'Md', 'No', 'Lr', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds',
'Rg', 'Cn', 'Uut', 'Fl', 'Uup', 'Lv', 'Uus', 'Uuo'
)



# Molar mass of natural compund
_relative_atomic_masses = (
"1.008 2.0(1) 4.002602(2) 6.94 9.0121831(5) 10.81 12.011 14.007 15.999"
" 18.998403163(6) 20.1797(6) 22.98976928(2) 24.305 26.9815385(7) 28.085"
" 30.973761998(5) 32.06 35.45 39.948(1) 39.0983(1) 40.078(4)"
" 44.955908(5) 47.867(1) 50.9415(1) 51.9961(6) 54.938044(3) 55.845(2)"
" 58.933194(4) 58.6934(4) 63.546(3) 65.38(2) 69.723(1) 72.630(8)"
" 74.921595(6) 78.971(8) 79.904 83.798(2) 85.4678(3) 87.62(1)"
" 88.90584(2) 91.224(2) 92.90637(2) 95.95(1) [98] 101.07(2) 102.90550(2)"
" 106.42(1) 107.8682(2) 112.414(4) 114.818(1) 118.710(7) 121.760(1)"
" 127.60(3) 126.90447(3) 131.293(6) 132.90545196(6) 137.327(7)"
" 138.90547(7) 140.116(1) 140.90766(2) 144.242(3) [145] 150.36(2)"
" 151.964(1) 157.25(3) 158.92535(2) 162.500(1) 164.93033(2) 167.259(3)"
" 168.93422(2) 173.045(10) 174.9668(1) 178.49(2) 180.94788(2) 183.84(1)"
" 186.207(1) 190.23(3) 192.217(3) 195.084(9) 196.966569(5) 200.592(3)"
" 204.38 207.2(1) 208.98040(1) [209] [210] [222] [223] [226] [227]"
" 232.0377(4) 231.03588(2) 238.02891(3) [237] [244] [243] [247] [247]"
" [251] [252] [257] [258] [259] [266] [267] [268] [269] [270] [269]"
" [278] [281] [282] [285] [286] [289] [289] [293] [294] [294]"
)


import regex as re



# Combination of https://stackoverflow.com/questions/26385984/recursive-pattern-in-regex
Expand Down
Binary file modified docs/Tutorials/Advanced/ConstantEnergy3D.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Advanced/FittedQEPlot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Advanced/RawQEPlot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Advanced/ViewerAnimationEPlane.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Advanced/ViewerAnimationEPlane.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Advanced/plotCutQELineMnF2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Advanced/plotCutQELineMnF21D.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Instrument/SimpleInstrument.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Instrument/SimpleInstrument2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Instrument/SimpleInstrument2_A4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Instrument/SimpleInstrument2_Ef.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/ConstantEnergy3DPolar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/ConstantEnergy3DXY.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/EnergyPlaneViewer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/HPlaneViewer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/OrthogonalPlaneViewer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/masking_10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/masking_40.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/masking_QELine.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Quick/plotCutQELineMnF2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Tools/Binning.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Tools/Here.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Tools/RLUAxis.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Tutorials/Tools/RLUAxis2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
author = u'Jakob Lass'

# The short X.Y version
version = u'1.1.17'
version = u'1.1.18'
# The full version, including alpha/beta/rc tags
release = u'1.1.17'
release = u'1.1.18'



Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
setup(
name='MJOLNIR',

version='1.1.17',
version='1.1.18',
description=('Neutron Scattering software suite.'),
long_description=long_description,
author='Jakob Lass',
Expand All @@ -39,7 +39,7 @@
'MJOLNIR3DView = MJOLNIR.CommandLineScripts.MJOLNIR3DView:main']
},
python_requires='>=3.5' if not operatingSystem == 'darwin' else '>=3.6',
install_requires=['matplotlib>=3','numpy>=1.14','h5py>=2.5','scipy','datetime','pytest>=4.6','pyperclip','decorator','pandas','future',
install_requires=['matplotlib>=3,<3.4','numpy>=1.14','h5py>=2.5','scipy','datetime','pytest>=4.6','pyperclip','decorator','pandas','future',
'pip>=20','ufit>=1.4.0','pyqtgraph','regex'], # ,'ufit','sip','PyQt5-sip','PyQt5<=5.12'
classifiers=[
'Development Status :: 3 - Alpha',
Expand All @@ -52,5 +52,6 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'],
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9'],
)

0 comments on commit 199caa8

Please sign in to comment.