Skip to content

Commit

Permalink
UPD: Documentation for Instrument method updated
Browse files Browse the repository at this point in the history
Added documentation for new methods in the Instrument class

Updated the changelog

[ci skip]
  • Loading branch information
pseudocubic committed Sep 2, 2015
1 parent 49a27df commit bc19ce1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
5 changes: 5 additions & 0 deletions doc/changelog.rst
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

* :release:`v0.3.2 <2015-09-02>`
* :feature:`34` Added method :py:meth:`.Instrument.plot_ellipsoid`
* :bug:`33` Fixed error in :py:meth:`.Instrument.calc_projections` where only giving one point would generate an error
* :feature:`24` Added plotting of Instrument setup diagram with :py:meth`.Instrument.plot_instrument`

* :release:`v0.3.1 <2015-08-14>`
* :feature:`32` Added a Aluminum spurion calculator
* :feature:`31` Beginnings of a :py:class:`.Goniometer` class added for future ability for crystal alignment
Expand Down
16 changes: 15 additions & 1 deletion doc/reference/examples/instrument.rst
Expand Up @@ -215,7 +215,7 @@ The following is an example of a resolution calculation using the Popovici metho

Simple Plotting of Resolution Ellipses
--------------------------------------
To see a simple plot of the resolution ellipses in the :math:`Q_x Q_y`, :math:`Q_x W` and :math:`Q_y W` zones the :py:meth:`.plot_projections` method may be used.
To see a simple plot of the resolution ellipses in the :math:`Q_x Q_y`, :math:`Q_x W` and :math:`Q_y W` zones the :py:meth:`.plot_projections` method may be used. This will also display instrument setup parameters and other useful information such as Bragg widths.

A very simple plot for the default instrument, containing resolution ellipses for several different energies at may be obtained with these commands

Expand All @@ -230,3 +230,17 @@ A very simple plot for the default instrument, containing resolution ellipses fo

EXP = Instrument()
EXP.plot_projections([1., 1., 0., linspace(0, 15, 7)])

Simple Plotting of the 3D Resolution Ellipsoid
----------------------------------------------
To see a simple plot of the resolution ellipsoid in the :math:`Q_x Q_y W` zone the :py:meth:`.plot_ellipsoid` method can be used.

>>> EXP = Instrument()
>>> EXP.plot_ellipsoid([1,0,0,0])

Plotting of the Instrument setup for a given (Q,W)
--------------------------------------------------
To see a plot of the instrument setup using the angles required for a given :math:`(Q, W)` the :py:meth:`.plot_instrument` method can be used.

>>> EXP = Instrument()
>>> EXP.plot_instrument([1,0,0,0])
17 changes: 15 additions & 2 deletions neutronpy/resolution.py
Expand Up @@ -904,6 +904,8 @@ class Instrument(object):
get_lattice
get_resolution_params
plot_projections
plot_ellipsoid
plot_instrument
resolution_convolution
resolution_convolution_SMA
Expand Down Expand Up @@ -2667,7 +2669,12 @@ def plot_projections(self, hkle, npts=36, dpi=100):
plt.show()

def plot_ellipsoid(self, hkle, dpi=100):
'''Plots the resolution ellipsoid in Qx, Qy, W Coordinates
r'''Plots the resolution ellipsoid in the $Q_x$, $Q_y$, $W$ zone
Parameters
----------
hkle : tup
A tuple of intergers or arrays of H, K, L, and W (energy transfer) values at which resolution ellipsoid are desired to be plotted
'''
from vispy import app, scene, visuals
Expand Down Expand Up @@ -2787,7 +2794,13 @@ def fn(r0, rms, q1, q2, q3, qx0, qy0, qw0):
app.run()

def plot_instrument(self, hkle):
'''Plots the instrument configuration for a given position in Q and energy transfer
'''Plots the instrument configuration using angles for a given position in Q and energy transfer
Parameters
----------
hkle : tup
A tuple of intergers or arrays of H, K, L, and W (energy transfer) values at which the instrument setup should be plotted
'''
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
Expand Down

0 comments on commit bc19ce1

Please sign in to comment.