generated from KaoruNishikawa/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#535 add 11713b
- Loading branch information
Showing
2 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from .rhio10 import RHIO10 # noqa: F401 | ||
from .a11713b import A11713B # noqa: F401 | ||
from .cpz340516 import CPZ340516 # noqa: F401 | ||
from .simulator import NetworkAttenuator # noqa: F401 | ||
from .rhio10 import RHIO10 # noqa: F401 | ||
from .simulator import CurrentAttenuator # noqa: F401 | ||
from .simulator import NetworkAttenuator # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import astropy.units as u | ||
import ogameasure | ||
|
||
from ...core.security import busy | ||
from ...utils import skip_on_simulator | ||
from .attenuator_base import NetworkAttenuator | ||
|
||
|
||
class A11713B(NetworkAttenuator): | ||
"""Attenuator, which can attennuate IF sigal power. | ||
Notes | ||
----- | ||
Configuration items for this device: | ||
host : str | ||
IP address for GPIB communicator. | ||
port : int | ||
GPIB port of using devices. | ||
channel : Dict[str] | ||
Human-readable channel name. The value should be | ||
mapping from human readableversion (str) to | ||
device level identifier (int). You can assign any name to the | ||
channels up to two channels: "X", "Y". | ||
For example: `{ 2R = X, 2L = Y}` | ||
""" | ||
|
||
Manufacturer = "Agilent" | ||
Model = "11713B" | ||
|
||
Identifier = "host" | ||
|
||
@skip_on_simulator | ||
def __init__(self) -> None: | ||
com = ogameasure.gpib_prologix(host=self.Config.host, gpibport=self.Config.port) | ||
self.io = ogameasure.Agilent.agilent_11713B(com) | ||
|
||
def get_loss(self, id: str) -> u.Quantity: | ||
with busy(self, "busy"): | ||
ch = self.Config.channel[id] | ||
try: | ||
return self.io.att_level_query(ch) * u.dB | ||
except IndexError: | ||
pass | ||
raise ValueError(f"Invalid channel: {ch}") | ||
|
||
def set_loss(self, dB: int, id: str) -> None: | ||
with busy(self, "busy"): | ||
ch = self.Config.channel[id] | ||
self.io.att_level_set(dB, ch) | ||
|
||
def finalize(self) -> None: | ||
self.io.com.close() |