obstools.deveny_grangle module

DeVeny Grating Angle Calculator Module

LDTObserverTools contains python ports of various LDT Observer Tools

Lowell Discovery Telescope (Lowell Observatory: Flagstaff, AZ) https://lowell.edu

This file contains the deveny_grangle routine for computing the needed grating tilt angle to be set in order to center the desired wavelength on the CCD. Both a CLI (direct copy of the IDL version) and GUI version are included here.

class obstools.deveny_grangle.DevenyGrangle[source]

Bases: ScriptBase

Script class for deveny_grangle tool

Script structure borrowed from pypeit.scripts.scriptbase.ScriptBase.

classmethod get_parser(width=None)[source]

Construct the command-line argument parser.

Parameters:
  • description (str, optional) – A short description of the purpose of the script.

  • width (int, optional) – Restrict the width of the formatted help output to be no longer than this number of characters, if possible given the help formatter. If None, the width is the same as the terminal width.

  • formatter (HelpFormatter) – Class used to format the help output.

Returns:

ArgumentParser – Command-line interpreter.

static main(args)[source]

Main Driver

Simple function that calls the appropriate driver function.

obstools.deveny_grangle.compute_grangle(lpmm: float, wavelen: float)[source]

Compute the needed grating angle

Given the grating’s line density and the desired central wavelength, compute the required grating angle. Uses scipy.optimize.newton() as the root-solver.

Parameters:
  • lpmm (float) – The line density of the grating in g/mm

  • wavelen (float) – The central wavelength in angstroms for which to compute the tilt

Returns:

  • grangle (float) – The desired grating angle

  • amag (float) – The anamorphic demagnification of the spectrograph at this grangle

obstools.deveny_grangle.deveny_amag(grangle: float) float[source]

Compute the anamorphic demagnification of the slit

The rays hitting the grating in the plane of α and β diffract to the camera in such a way that the beam width changes as a function of α and β, whereas rays incident on the grating in the perpendicular plane have the same beam width upon incidence and reflection. Because there is a difference between the beam widths for the two planes, there will be different magnification levels (Schweizer, 1979). Whenever perpendicular planes have different magnifications, this is called “anamorphic” (de)magnification. Schweizer (1979), however, thinks the term “anamorphic magnification” is somewhat inaccurate, and prefers “grating magnification”. Historically, the DeVeny manuals and associated code (e.g., deveny_grangle) use “anamorphic”, so we continue that there. The resulting magnification in the direction of dispersion due to the grating, r, arising from differentiation of the grating equation, is:

\[r \equiv \frac{dβ}{dα} = \frac{cos α}{cosβ}\]

(Schweizer, 1979). Practical spectrograph design aligns the slit perpendicular to the dispersion direction, and so the change in magnification is in the direction of the slit width, hence our quoted “anamorphic demagnification of slit width”.

Parameters:

grangle (float) – The desired grating angle (in degrees)

Returns:

float – The anamorphic demagnification factor

obstools.deveny_grangle.deveny_grangle_cli()[source]

Compute the desired grating angle given grating and central wavelength

Command line version of deveny_grangle, direct port of the IDL version. Takes no arguments, returns nothing, and prints output to screen.

obstools.deveny_grangle.deveny_grangle_gui(max_gui: bool = False)[source]

Main Driver for the DeVeny Grangle GUI

Compute the desired grating angle given grating and central wavelength

GUI version of deveny_grangle built using PySimpleGUI. The GUI includes a drop-down menu for available gratings, and checks for a requested wavelength between 3000A and 11,000A. This interface uses the same subroutines as the CLI version and produces the same results.

This version optionally allows for the calcuation of the central wavelength given a grating angle

Parameters:

max_gui (bool, optional) – Display the MAX GUI (forward and backward calculations) (Default: False)

obstools.deveny_grangle.grangle_eqn(theta: float, lpmm: float, wavelen: float) float[source]

The grating equation used to find the angle

This is the equation for which scipy.optimize.newton() is finding the root.

Parameters:
  • theta (float) – The grating angle being tested for (in radians)

  • lpmm (float) – The line density of the grating in g/mm

  • wavelen (float) – The central wavelength in angstroms for which to compute the tilt

Returns:

float – The portion of the grating equation to be set to zero.

obstools.deveny_grangle.lambda_at_angle(theta: float, lpmm: float, radians: bool = False) float[source]

Compute the central wavelength given theta

Use the grating equation to compute the central wavelength given theta

Parameters:
  • theta (float) – Grating Angle

  • lpmm (float) – The line density of the grating in g/mm

  • radians (bool, optional) – The input angle is in radians (Default: False)

Returns:

float – The computed central wavelength