Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
HPIB
Commits
777a3bdd
Commit
777a3bdd
authored
May 06, 2018
by
Tammo Jan Dijkema
Browse files
Add module and class level documentation
parent
1d887dbb
Changes
3
Hide whitespace changes
Inline
Side-by-side
camrasdevices.py
View file @
777a3bdd
"""HPIB wrappers for devices in the Dwingeloo telescope
This module contains some classes for conveniently working with the devices in the Dwingeloo
Telescope that communicate over GPIB (General Purpuse Interface Bus) or HPIB (presumably the
HP variant of GPIB). Currently, three of these devices exist, on different HPIB addresses:
* Receiver (address 1)
* Local Oscillator (address 28), used for mixing signals to downconvert them
* Clock Generator (address 14), used as the clock for the FPGA
For each of the three devices a class exists. Setting and getting the frequency of these
devices is done by using their `frequency` attribute.
Example:
>>> import camrasdevices
>>> lo = LocalOscillator()
>>> lo.frequency
<Quantity 1.0 GHz>
>>> lo.frequency = 1.1e9
>>> lo.frequency
<Quantity 1.1 GHz>
By default, the setter method of `frequency` checks if setting the device succeeded. This is a
blocking operation, but the HPIB bus is quite fast.
>>> lo.frequency = 1.e18
Traceback (most recent call last):
RuntimeError: Setting frequency failed: tried to set to 1e+18 Hz, it is now 1100000000.0 Hz
This checking can be disabled:
>>> non_checking_lo = camrasdevices.LocalOscillator(check_frequency = False)
>>> non_checking_lo.frequency = 1.e18
>>> non_checking_lo.frequency
<Quantity 1.1 GHz>
The CamrasHpibDevice class spawns one thread (shared with all instances) to perform the HPIB
commands. This is to make sure that instances living in separate threads do not interfere with
each other. The thread is a daemon, so it will be killed on program exit.
On initialization of the first CamrasDevice (or subclass), the command thread is initialized, and
some initialization commands are sent to the HPIB bus to tell it to use the appropriate line
endings etc.
"""
import
astropy.units
as
u
import
astropy.units
as
u
from
astropy.units
import
Quantity
from
astropy.units
import
Quantity
...
...
hpib.py
View file @
777a3bdd
"""Implementation of the GPIB protocol for use with serial.threading
This class implements the GPIB (General Purpose Interface Bus) protocol following the example at
https://github.com/pyserial/pyserial/blob/master/examples/at_protocol.py
"""
import
serial.threaded
import
serial.threaded
import
threading
import
threading
...
...
track_doppler.py
View file @
777a3bdd
"""Doppler tracking functions by setting the local oscillator frequency over HPIB
"""
from
typing
import
Any
,
Union
from
typing
import
Any
,
Union
import
astropy.units
as
u
import
astropy.units
as
u
...
@@ -13,6 +16,19 @@ freq_hi = 1420.405751 * u.MHz
...
@@ -13,6 +16,19 @@ freq_hi = 1420.405751 * u.MHz
def
doppler_harm
(
sky_coordinate
,
time
,
tracking_frequency
,
location
,
variant
):
def
doppler_harm
(
sky_coordinate
,
time
,
tracking_frequency
,
location
,
variant
):
"""Return the doppler frequency by using the executables in Harm's home directory
Args:
sky_coordinate (SkyCoordinate): line of sight
time (Time): Astropy time object with time of the conversion
tracking_frequency (Quantity): frequency to track
location (EarthLocation): position of observatory (typically Dwingeloo)
variant (str): standard to use for the sun's movement: "bl" (IAU, based on Blaauw) for or
"mb" (Mihalas & Binney)
Returns:
Quantity: Doppler frequency
"""
ra
=
sky_coordinate
.
ra
.
to
(
u
.
rad
).
value
ra
=
sky_coordinate
.
ra
.
to
(
u
.
rad
).
value
dec
=
sky_coordinate
.
dec
.
to
(
u
.
rad
).
value
dec
=
sky_coordinate
.
dec
.
to
(
u
.
rad
).
value
t
=
time
.
unix
t
=
time
.
unix
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment