ncrystal-python 4.2.0__tar.gz → 4.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/PKG-INFO +1 -1
  2. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/__init__.py +1 -1
  3. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_common.py +26 -0
  4. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_ncmat2endf_impl.py +3 -1
  5. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/ncmat2endf.py +2 -2
  6. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/ncrystal_python.egg-info/PKG-INFO +1 -1
  7. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/LICENSE +0 -0
  8. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/README.md +0 -0
  9. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/pyproject.toml +0 -0
  10. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/setup.cfg +0 -0
  11. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/__main__.py +0 -0
  12. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_chooks.py +0 -0
  13. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_cif2ncmat.py +0 -0
  14. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_endf2ncmat.py +0 -0
  15. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_hfg2ncmat.py +0 -0
  16. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_mcstasunion.py +0 -0
  17. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_ncmat2cpp.py +0 -0
  18. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_ncmat2endf.py +0 -0
  19. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_ncmat2hkl.py +0 -0
  20. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_nctool.py +0 -0
  21. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_vdos2ncmat.py +0 -0
  22. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cli_verifyatompos.py +0 -0
  23. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cliimpl.py +0 -0
  24. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_cliwrap_config.py +0 -0
  25. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_coreimpl.py +0 -0
  26. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_hfgdata.py +0 -0
  27. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_hklobjects.py +0 -0
  28. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_is_std.py +0 -0
  29. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_locatelib.py +0 -0
  30. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_miscimpl.py +0 -0
  31. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_mmc.py +0 -0
  32. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_msg.py +0 -0
  33. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_ncmat2cpp_impl.py +0 -0
  34. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_ncmatimpl.py +0 -0
  35. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_numpy.py +0 -0
  36. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_sabutils.py +0 -0
  37. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/_testimpl.py +0 -0
  38. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/api.py +0 -0
  39. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/atomdata.py +0 -0
  40. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/cfgstr.py +0 -0
  41. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/cifutils.py +0 -0
  42. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/cli.py +0 -0
  43. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/constants.py +0 -0
  44. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/core.py +0 -0
  45. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/datasrc.py +0 -0
  46. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/exceptions.py +0 -0
  47. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/hfg2ncmat.py +0 -0
  48. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/mcstasutils.py +0 -0
  49. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/misc.py +0 -0
  50. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/mmc.py +0 -0
  51. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/ncmat.py +0 -0
  52. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/ncmat2cpp.py +0 -0
  53. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/obsolete.py +0 -0
  54. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/plot.py +0 -0
  55. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/plugins.py +0 -0
  56. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/test.py +0 -0
  57. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/NCrystal/vdos.py +0 -0
  58. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/ncrystal_python.egg-info/SOURCES.txt +0 -0
  59. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/ncrystal_python.egg-info/dependency_links.txt +0 -0
  60. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/ncrystal_python.egg-info/entry_points.txt +0 -0
  61. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/ncrystal_python.egg-info/requires.txt +0 -0
  62. {ncrystal_python-4.2.0 → ncrystal_python-4.2.2}/src/ncrystal_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ncrystal-python
3
- Version: 4.2.0
3
+ Version: 4.2.2
4
4
  Summary: Library for thermal neutron transport in crystals and other materials.
5
5
  Author: NCrystal developers (Thomas Kittelmann, Xiao Xiao Cai)
6
6
  License:
@@ -55,7 +55,7 @@ For detailed usage conditions and licensing of this open source project, see:
55
55
 
56
56
  #NB: Synchronize meta-data below with fields in setup.py+template_setup.py.in meta data:
57
57
  __license__ = "Apache 2.0, http://www.apache.org/licenses/LICENSE-2.0"
58
- __version__ = '4.2.0'
58
+ __version__ = '4.2.2'
59
59
  __status__ = "Production"
60
60
  __author__ = "NCrystal developers (Thomas Kittelmann, Xiao Xiao Cai)"
61
61
  __copyright__ = "Copyright 2015-2024 %s"%__author__
@@ -514,3 +514,29 @@ def _lookup_existing_file( path ):
514
514
  p = pathlib.Path(dd).joinpath(path)
515
515
  if p.exists():
516
516
  return p.absolute()
517
+
518
+ _override_datetime_now = [ None ]
519
+ def _datetime_now():
520
+ """Returns datetime.datetime.now() but possibly intercepted for unit tests"""
521
+ import datetime
522
+ n = datetime.datetime.now()
523
+ return _override_datetime_now[0] or n
524
+
525
+ class FixedFakeDatetimeNow():
526
+ # Context manager to be used in unit tests to modify the returned value from
527
+ # the datetime_now function below, to a fixed value.
528
+ def __enter__(self):
529
+ import datetime
530
+ self.__orig = _override_datetime_now[0]
531
+ _override_datetime_now[0] = datetime.datetime( 2017, 8, 29, 13, 40,
532
+ tzinfo
533
+ = datetime.timezone.utc )
534
+ def __exit__(self,*args,**kwargs):
535
+ _override_datetime_now[0] = self.__orig
536
+
537
+ def fixed_fake_datetime_now(f):
538
+ #To be used as a decorator
539
+ def fw(*a, **kw):
540
+ with FixedFakeDatetimeNow():
541
+ return f(*a, **kw)
542
+ return fw
@@ -1524,7 +1524,9 @@ def _tidy_beta( x, allow_negative=False):
1524
1524
  assert -1e99 <= x <= 1e99
1525
1525
  else:
1526
1526
  assert 0.0 <= x <= 1e99
1527
- if x > 8:
1527
+ if x < -120:
1528
+ return float('%.1g'%x)
1529
+ if abs(x) > 8:
1528
1530
  return float('%.2g'%x)
1529
1531
  return float('%.3g'%x)
1530
1532
 
@@ -185,12 +185,12 @@ class EndfMetaData():
185
185
  (key,value) pairs, or another EndfMetaData object, the associated values
186
186
  will be updated accordingly.
187
187
  """
188
- from datetime import datetime
188
+ from ._common import _datetime_now
189
189
  import copy
190
190
  from ._ncmat2endf_impl import _metadata_definitions
191
191
  self.__data = dict( (k,copy.deepcopy(v['defval']))
192
192
  for k,v in _metadata_definitions.items() )
193
- self.__now_MMMYY = datetime.now().strftime('%b%y').upper()
193
+ self.__now_MMMYY = _datetime_now().strftime('%b%y').upper()
194
194
  if data:
195
195
  self.update_from_dict(data)
196
196
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ncrystal-python
3
- Version: 4.2.0
3
+ Version: 4.2.2
4
4
  Summary: Library for thermal neutron transport in crystals and other materials.
5
5
  Author: NCrystal developers (Thomas Kittelmann, Xiao Xiao Cai)
6
6
  License:
File without changes