@@ -447,9 +447,6 @@ def __init__(self, components, component_name):
447447 self .root_prop_node = None
448448 """Root node of the component."""
449449
450- self .units = components ._parent .get_units ()
451- """Units for the component."""
452-
453450 @property
454451 def composed_name (self ):
455452 """Component name. Needed for compatibility."""
@@ -745,7 +742,7 @@ def get_position(self, units=""):
745742
746743 # Check the units specified are a valid EMIT length
747744 if not units or units not in emit_consts .EMIT_VALID_UNITS ["Length" ]:
748- units = self . units [ "Length" ]
745+ units = "meter"
749746 position = (
750747 consts .unit_converter (float (parts [0 ]), "Length" , "meter" , units ),
751748 consts .unit_converter (float (parts [1 ]), "Length" , "meter" , units ),
@@ -817,14 +814,14 @@ def band_start_frequency(self, band_node, units=""):
817814 ----------
818815 band_node : Instance of the band node.
819816 units : str, optional
820- If ``None`` specified, global units are used.
817+ If ``None`` specified, SI units (Hz) are used.
821818
822819 Returns
823820 -------
824821 Float
825822 Start frequency of the band node."""
826823 if not units or units not in emit_consts .EMIT_VALID_UNITS ["Frequency" ]:
827- units = self . units [ "Frequency" ]
824+ units = "Hz"
828825 return consts .unit_converter (float (band_node .props ["StartFrequency" ]), "Freq" , "Hz" , units )
829826
830827 def band_stop_frequency (self , band_node , units = "" ):
@@ -834,14 +831,14 @@ def band_stop_frequency(self, band_node, units=""):
834831 ----------
835832 band_node : Instance of the band node.
836833 units : str, optional
837- If ``None`` specified, global units are used.
834+ If ``None`` specified, SI units (Hz) are used.
838835
839836 Returns
840837 -------
841838 Float
842839 Stop frequency of the band node."""
843840 if not units or units not in emit_consts .EMIT_VALID_UNITS ["Frequency" ]:
844- units = self . units [ "Frequency" ]
841+ units = "Hz"
845842 return consts .unit_converter (float (band_node .props ["StopFrequency" ]), "Freq" , "Hz" , units )
846843
847844 def set_band_start_frequency (self , band_node , band_start_freq , units = "" ):
@@ -934,69 +931,21 @@ def set_band_stop_frequency(self, band_node, band_stop_freq, units=""):
934931 prop_list = {"StopFrequency" : freq_string }
935932 band_node ._set_prop_value (prop_list )
936933
937- # def duplicate_band(self, band_node_to_duplicate):
938- # """
939- # [Incomplete 10/19/2023]
940- # Parameters
941- # ----------
942- # band_node_to_duplicate
943- #
944- # Returns
945- # -------
946- #
947- # """
948- # # append number to the name of the band to duplicate.
949- # print('Duplicating...')
950- #
951- #
952- # # return band node
953- # def convert_channels_to_multi_bands(self, band_node):
954- # """
955- # [Incomplete 10/19/2023]
956- # Parameters
957- # ----------
958- # band_node
959- #
960- # Returns
961- # -------
962- #
963- # """
964- # # get the channels. Say returns 10 channels in the band_node
965- # # Name = r.bands()[0].children[0].props['Name']
966- # # band_node.props['Name']
967- # # Start = r.bands()[0].props['StartFrequency']
968- # band_start_frequency = float(band_node.props['StartFrequency'])
969- # # Stop = r.bands()[0].props['StopFrequency']
970- # band_stop_frequency = float(band_node.props['StopFrequency'])
971- # # Spacing = r.bands()[0].props['ChannelSpacing']
972- # channel_spacing = float(band_node.props['ChannelSpacing'])
973- # # for each channel
974- # # 1) create a band (duplicate original one)
975- # # 2) set band start and stop frequencies
976- # for channel in list(range(int(band_start_frequency), int(band_stop_frequency), int(channel_spacing))):
977- # baby_band_start = channel
978- # baby_band_stop = channel+channel_spacing
979- # baby_band_node = self.duplicate_band(band_node) # return band name or some handle to it
980- # self.set_band_start_frequency(baby_band_node, baby_band_start)
981- # self.set_band_stop_frequency(baby_band_node, baby_band_stop)
982- # # set start and stop freq for that band name
983- # # to be
984-
985934 def band_channel_bandwidth (self , band_node , units = "" ):
986935 """Get the channel bandwidth of the band node.
987936
988937 Parameters
989938 ----------
990939 band_node : Instance of the band node.
991940 units : str, optional
992- If ``None`` specified, global units are used.
941+ If ``None`` specified, SI units (Hz) are used.
993942
994943 Returns
995944 -------
996945 Float
997946 Channel bandwidth of the band node."""
998947 if not units or units not in emit_consts .EMIT_VALID_UNITS ["Frequency" ]:
999- units = self . units [ "Frequency" ]
948+ units = "Hz"
1000949 return consts .unit_converter (float (band_node .props ["ChannelBandwidth" ]), "Freq" , "Hz" , units )
1001950
1002951 def band_tx_power (self , band_node , units = "" ):
@@ -1006,14 +955,15 @@ def band_tx_power(self, band_node, units=""):
1006955 ----------
1007956 band_node : Instance of the band node.
1008957 units : str
1009- Units to use for the tx power.
958+ Units to use for the tx power. If none specified,
959+ SI units (W) are used
1010960
1011961 Returns
1012962 -------
1013963 Float
1014964 Transmit power of the band node."""
1015965 if not units or units not in emit_consts .EMIT_VALID_UNITS ["Power" ]:
1016- units = self . units [ "Power" ]
966+ units = "W"
1017967 for child in band_node .children :
1018968 if child .props ["Type" ] == "TxSpectralProfNode" :
1019969 return consts .unit_converter (float (child .props ["FundamentalAmplitude" ]), "Power" , "dBm" , units )
@@ -1142,7 +1092,7 @@ def set_band_power_level(self, power, units=""):
11421092 power : float
11431093 Peak amplitude of the fundamental [dBm].
11441094 units : str, optional
1145- Units of the input power. If None specified, global units are used.
1095+ Units of the input power. If None specified, SI units (W) are used.
11461096
11471097 Return
11481098 ------
@@ -1170,7 +1120,7 @@ def get_band_power_level(self, units=""):
11701120 Parameters
11711121 ----------
11721122 units : str, optional
1173- Units to use for the power. If None specified, global units are used.
1123+ Units to use for the power. If None specified, SI units (W) are used.
11741124
11751125 Return
11761126 ------
@@ -1181,7 +1131,7 @@ def get_band_power_level(self, units=""):
11811131 raise TypeError (f"{ self .node_name } must be a band." )
11821132 # Power is stored in dBm, convert to desired units
11831133 if not units or units not in emit_consts .EMIT_VALID_UNITS ["Power" ]:
1184- units = self . parent_component . units [ "Power" ]
1134+ units = "W"
11851135 for child in self .children :
11861136 if child .props ["Type" ] == "TxSpectralProfNode" :
11871137 power = child .props ["FundamentalAmplitude" ]
0 commit comments