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
#534 anritsu sg
- Loading branch information
Showing
9 changed files
with
184 additions
and
14 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
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 .E8257D import E8257D # noqa: F401 | ||
from .e8257d import E8257D # noqa: F401 | ||
from .fsw0010 import FSW0010 # noqa: F401 | ||
from .fsw0020 import FSW0020 # noqa: F401 | ||
from .mg3692c import MG3692C # noqa: F401 | ||
from .simulator import SignalGeneratorSimulator # 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
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,89 @@ | ||
import time | ||
from typing import Optional, Union | ||
|
||
import astropy.units as u | ||
import ogameasure | ||
|
||
from ...core.security import busy | ||
from ...core.units import dBm | ||
from ...utils import skip_on_simulator | ||
from .signal_generator_base import SignalGenerator | ||
|
||
|
||
class MG3692C(SignalGenerator): | ||
"""Signal Generator, which can supply Local Signal. | ||
Notes | ||
----- | ||
Configuration items for this device: | ||
host : str | ||
IP address for ethernet communicator. | ||
port : int | ||
ethernet port of using devices. | ||
""" | ||
|
||
Manufacturer: str = "Anritsu" | ||
Model = "MG3692C" | ||
|
||
Identifier = "host" | ||
|
||
@skip_on_simulator | ||
def __init__(self) -> None: | ||
com = ogameasure.gpib_prologix(host=self.Config.host, gpibport=self.Config.port) | ||
self.sg = ogameasure.Anritsu.mg3692c(com) | ||
|
||
def set_freq(self, GHz: Union[int, float]) -> None: | ||
with busy(self, "busy"): | ||
self.sg.freq_set(GHz) | ||
time.sleep(0.1) | ||
return | ||
|
||
def set_power(self, dBm: Union[int, float]) -> None: | ||
with busy(self, "busy"): | ||
self.sg.power_set(dBm) | ||
time.sleep(0.1) | ||
return | ||
|
||
def get_freq(self) -> u.Quantity: | ||
with busy(self, "busy"): | ||
f = self.sg.freq_query() | ||
time.sleep(0.1) | ||
return f * u.Hz | ||
|
||
def get_power(self) -> u.Quantity: | ||
with busy(self, "busy"): | ||
f = self.sg.power_query() | ||
time.sleep(0.1) | ||
return f * dBm | ||
|
||
def start_output(self) -> None: | ||
with busy(self, "busy"): | ||
self.sg.output_on() | ||
time.sleep(0.1) | ||
return | ||
|
||
def stop_output(self) -> None: | ||
with busy(self, "busy"): | ||
self.sg.output_off() | ||
time.sleep(0.1) | ||
return | ||
|
||
def get_output_status(self) -> Optional[bool]: | ||
with busy(self, "busy"): | ||
f = self.sg.output_query() | ||
time.sleep(0.1) | ||
if f == 1: | ||
return True | ||
elif f == 0: | ||
return False | ||
else: | ||
return None | ||
|
||
def finalize(self) -> None: | ||
self.stop_output() | ||
self.sg.close() | ||
return |
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,17 @@ | ||
import pytest | ||
|
||
from neclib.devices.attenuator.cpz340516 import CPZ340516 | ||
|
||
from ..conftest import get_instance | ||
|
||
pytestmark = pytest.mark.skipif( | ||
get_instance(CPZ340516) is None, reason="cpz340516 is not configured" | ||
) | ||
|
||
|
||
class TestRhio10: | ||
def test_config_type(self): | ||
attenuator = get_instance(CPZ340516) | ||
assert type(attenuator.Config.rsw_id) is int | ||
assert type(attenuator.Config.range) is str | ||
assert type(attenuator.Config.channel) is str |
Empty file.
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,15 @@ | ||
import pytest | ||
|
||
from neclib.devices.membrane.cpz2724 import CPZ2724 | ||
|
||
from ..conftest import get_instance | ||
|
||
pytestmark = pytest.mark.skipif( | ||
get_instance(CPZ2724) is None, reason="CPZ2724 is not configured" | ||
) | ||
|
||
|
||
class TestCPZ3177: | ||
def test_config_type(self): | ||
membrane = get_instance(CPZ2724) | ||
assert type(membrane.Config.rsw_id) is int |
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,18 @@ | ||
import pytest | ||
|
||
from neclib.devices.signal_generator.e8257d import E8257D | ||
|
||
from ..conftest import get_instance | ||
|
||
pytestmark = pytest.mark.skipif( | ||
get_instance(E8257D) is None, reason="E8257D is not configured" | ||
) | ||
|
||
|
||
class TestML2437A: | ||
def test_config_type(self): | ||
sg = get_instance(E8257D) | ||
assert type(sg.Config.communicator) is str | ||
assert type(sg.Config.host) is str | ||
assert type(sg.Config.gpib_port) is int | ||
assert type(sg.Config.lan_port) is int |
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,16 @@ | ||
import pytest | ||
|
||
from neclib.devices.signal_generator.mg3692c import MG3692C | ||
|
||
from ..conftest import get_instance | ||
|
||
pytestmark = pytest.mark.skipif( | ||
get_instance(MG3692C) is None, reason="MG3692C is not configured" | ||
) | ||
|
||
|
||
class TestML2437A: | ||
def test_config_type(self): | ||
sg = get_instance(MG3692C) | ||
assert type(sg.Config.host) is str | ||
assert type(sg.Config.port) is int |