Code Monkey home page Code Monkey logo

diffcalc-core's Introduction

diffcalc-core's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

lgtm-migrator

diffcalc-core's Issues

Formating of position object in diffcalc.hkl.calc.py '_verify_pos_map_to_hkl' exception

  • diffcalc version: 0.30
  • Python version: 3.9.2, internal Blender verion
  • Operating System: Windows 10 Enterprise

Description

I tried to calculate a move to a hkl position after manually setting a UB matrix I copied from a nexus file of a real experiment. The exception output string did not have the calculated position, but a pointer to the position object instead. I assume it was supposed to be Eulerian angles.

Also, would anyone have an idea what can cause this error in the first place?
edit: This can happen if the real space lattice does not match the UB matrix

What I Did

>>> pos(hkl, [0.2,-0.2,4])
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Users\axw86756\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\i16sim\DiffcalcEmulator.py", line 365, in pos
    pos, virtual_angles = self.pos_from_hkl(val)
  File "C:\Users\axw86756\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\i16sim\DiffcalcEmulator.py", line 256, in pos_from_hkl
    for pos, virtual_angles in self.hklcalc.get_position(hkl[0], hkl[1], hkl[2], self.wl):
  File "C:\Users\axw86756\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\i16sim\diffcalc\hkl\calc.py", line 200, in get_position
    self._verify_pos_map_to_hkl(h, k, l, wavelength, pos)
  File "C:\Users\axw86756\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\i16sim\diffcalc\hkl\calc.py", line 1756, in _verify_pos_map_to_hkl
    raise DiffcalcException(s)
i16sim.diffcalc.util.DiffcalcException: 

***********************************************************************************************************************************************
* ERROR: The angles calculated for hkl=(0.200000,-0.200000,4.000000) were <i16sim.diffcalc.hkl.geometry.Position object at 0x0000028E4793BD90>.
* Converting these angles back to hkl resulted in hkl=(0.203564,-0.203564,4.071290)
***********************************************************************************************************************************************

log.py filename crash

  • diffcalc version: 0.3.0
  • Python version: 3.9.2
  • Operating System: Windows 10 Enterprise
    log error.txt

Description

I was trying to run the sixcircle.py example after pip-installing diffcalc core.

What I Did

The script failed when trying to run "from diffcalc.hkl.calc import HklCalculation", because the file given in log.py does not exist.
I fixed it by giving it a path to an existing file, and now it works fine.

It would be nice if could run diffcalc-core without editing the source files in the future.
Cheers!

Traceback:
  File "C:\Unsorted Stuff\Work Files\Blender tests\Prototype\Script tests\prototype12.blend\six_circle.py", line 12, in <module>
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\site-packages\diffcalc\hkl\calc.py", line 20, in <module>
    from diffcalc.log import logging
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\site-packages\diffcalc\log.py", line 5, in <module>
    logging.basicConfig(
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\logging\__init__.py", line 1999, in basicConfig
    h = FileHandler(filename, mode,
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\logging\__init__.py", line 1142, in __init__
    StreamHandler.__init__(self, self._open())
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\logging\__init__.py", line 1171, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding,
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\tmp\\diffcalc_axw86756.log'
Error: Python script failed, check the message in the system console

Make 'hkl.calc.get_position(h, k, l, wl)' value error "Reflection un-reachable as wavelength is more than twice the plane distance" optional

  • diffcalc version: "0.3.0"

Description

I tried to use diffcalc.hkl.calc.get_position(h, k, l, wl) as an inverse function for diffcalc.hkl.calc.get_hkl(position, wl). Unfortunately hkl.calc.get_position(...) calls diffcalc.ub.calc.get_ttheta_from_hkl(...) which causes a value error "Reflection un-reachable as wavelength is more than twice the plane distance".

While the value error is useful, in some experiments we do not need reflections, therefore it would be nice if it was possible to disable the wavelength check by passing an optional parameter to hkl.calc.get_position(...).

What I Did

>>> position = from_dict( {'mu': 0.0, 'delta': -152.48879319965724, 'nu': 0.0, 'eta': 161.73383227310455, 'chi': 76.12246777334896, 'phi': 115.4117691228348} )

>>> hkl = hklcalc.get_hkl()
hkl = (-7.968596623892839, -2.41815898096361, 5.000000000000002)

>>> pos,va = hklcalc.get_position(*hkl, 1)
ValueError: Reflection un-reachable as wavelength (1.000000) is more than twice
the plane distance (0.335053)

#instead I would like {'mu': 0.0, 'delta': -152.48879319965724, 'nu': 0.0, 'eta': 161.73383227310455, 'chi': 76.12246777334896, 'phi': 115.4117691228348}  to be in the list of positions in the output

I was using UB matrix:
ubcalc.UB = array(
[[ 1.25663706e+00, -2.16461568e-16, 7.69468277e-17],
[ 1.43789156e-17, 1.25663706e+00, -6.97573700e-17],
[-2.79029480e-16, -7.18945779e-18, 1.25663706e+00]])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.