Public API

The public functions are available from the top-level nrarfcn package.

Release selection

3GPP Rel-17 is used by default for NR. To use another supported NR release, pass release_3gpp to any API function. LTE/E-UTRA APIs use Rel-19 by default.

>>> import nrarfcn as nr
>>> nr.get_frequency_range('n110', release_3gpp=19)
(1432, 1435)
>>> nr.get_frequency_by_lte_earfcn(300)
2140.0

Functions

nrarfcn.get_frequency(nrarfcn: int, release_3gpp: int = 17) float

Gets the frequency of a given NR-ARFCN, in MHz.

Parameters:
  • nrarfcn – The NR-ARFCN to get the frequency of.

  • release_3gpp – The 3GPP release to use for table lookup.

Returns:

The frequency of the given NR-ARFCN, in MHz.

Raises:

ValueError – If the NR-ARFCN is not valid.

nrarfcn.get_nrarfcn(frequency: float, release_3gpp: int = 17) int

Gets the NR-ARFCN of a given frequency in MHz.

Parameters:
  • frequency – The frequency to get the NR-ARFCN of, in MHz.

  • release_3gpp – The 3GPP release to use for table lookup.

Returns:

The NR-ARFCN of the given frequency.

Raises:

ValueError – If the frequency is not valid.

nrarfcn.get_bands_by_frequency(frequency: float, release_3gpp: int = 17) List[str]

Lists the possible 5G-NR bands of a given frequency in MHz.

Parameters:
  • frequency – The frequency to get the bands of, in MHz.

  • release_3gpp – The 3GPP release to use for table lookup.

Returns:

A list of the 5G-NR bands that the given frequency is in. Empty list if not in any NR band.

Raises:

ValueError – If the frequency is not an int and not a float, or out of NR-ARFCN defined range.

nrarfcn.get_bands_by_nrarfcn(nrarfcn: int, release_3gpp: int = 17) list

Gets the bands of a given NR-ARFCN.

Parameters:
  • nrarfcn – The NR-ARFCN to get the bands of.

  • release_3gpp – The 3GPP release to use for table lookup.

Returns:

The bands of the given NR-ARFCN.

Raises:

ValueError – If the NR-ARFCN is not valid.

nrarfcn.get_duplex_mode(band: str | int, release_3gpp: int | None = None) str

Gets the duplex mode for a given band.

Parameters:
  • band – The band to get the duplex mode for. NR bands use ‘n’, LTE bands use ‘B’.

  • release_3gpp – The 3GPP release to use for table lookup. NR defaults to Rel-17; LTE defaults to Rel-19.

Returns:

The duplex mode for the given band.

Raises:

ValueError – If the given band is not valid.

nrarfcn.get_nrarfcn_range(band: str | int, direction='', release_3gpp: int = 17) tuple

Gets the NR-ARFCN range for a given band.

Parameters:
  • band – The band to get the range for, e.g. ‘n12’.

  • direction – ‘dl’ or ‘ul’ to get the range for the downlink or uplink. If not specified, ‘dl’ is used, except if the band is uplink only.

  • release_3gpp – The 3GPP release to use for table lookup.

Returns:

A tuple with the min NR-ARFCN and max NR-ARFCN for the given band and direction

Raises:

ValueError – If the given band is not a valid band.

nrarfcn.get_frequency_range(band: str | int, direction='', release_3gpp: int | None = None) tuple

Gets the frequency range for a given band, in MHz.

Parameters:
  • band – The band to get the range for, e.g. ‘n12’ or ‘B12’.

  • direction – ‘dl’ or ‘ul’ to get the range for the downlink or uplink. If not specified, ‘dl’ is used, except if the NR band is uplink only.

  • release_3gpp – The 3GPP release to use for table lookup. NR defaults to Rel-17; LTE defaults to Rel-19.

Returns:

A tuple with the min frequency in MHz and max frequency in MHz for the given band and direction

Raises:

ValueError – If the given band is not a valid band.

nrarfcn.get_gscn_by_frequency(freq: float, release_3gpp: int = 17) int

Gets the GSCN (Global Synchronization Channel Number) of a given frequency in MHz.

Parameters:
  • freq – The frequency to get the GSCN of.

  • release_3gpp – The 3GPP release to use for table lookup.

Returns:

The GSCN of the given frequency, in MHz, or the closest GSCN to the given frequency.

Raises:

ValueError – If the given frequency is invalid

nrarfcn.get_frequency_by_gscn(gscn: int, release_3gpp: int = 17) float

Gets the frequency of a given GSCN (Global Synchronization Channel Number), in MHz.

Parameters:
  • gscn – The GSCN to get the frequency of.

  • release_3gpp – The 3GPP release to use for table lookup.

Returns:

The frequency of the given GSCN, in MHz.

Raises:

ValueError – If the given GSCN is invalid

nrarfcn.get_gscn_range(band: str | int, release_3gpp: int = 17) tuple

Gets the GSCN range for a given band.

Parameters:
  • band – The band to get the range for, e.g. ‘n12’ or 12.

  • release_3gpp – The 3GPP release to use for table lookup.

Returns:

A tuple with the min GSCN and max GSCN for the given band.

Raises:

ValueError – If the given band is not a valid band.

nrarfcn.get_frequency_by_lte_earfcn(earfcn: int, release_3gpp: int = 19) float

Gets the frequency of a given LTE EARFCN, in MHz.

Parameters:
  • earfcn – The LTE EARFCN to get the frequency of.

  • release_3gpp – The 3GPP release to use for table lookup. LTE defaults to Rel-19.

Returns:

The frequency of the given LTE EARFCN, in MHz.

Raises:

ValueError – If the LTE EARFCN is not valid.

nrarfcn.get_lte_earfcn_by_frequency(frequency: float, release_3gpp: int = 19) List[int]

Lists the possible LTE EARFCNs for a given frequency in MHz.

Parameters:
  • frequency – The frequency to get the LTE EARFCNs of, in MHz.

  • release_3gpp – The 3GPP release to use for table lookup. LTE defaults to Rel-19.

Returns:

A numerically sorted list of LTE EARFCNs for the given frequency. Empty list if no LTE EARFCN matches.

Raises:

ValueError – If the frequency is not an int and not a float, or out of range.

nrarfcn.get_lte_bands_by_frequency(frequency: float, release_3gpp: int = 19) List[str]

Lists the possible LTE bands of a given frequency in MHz.

Parameters:
  • frequency – The frequency to get the bands of, in MHz.

  • release_3gpp – The 3GPP release to use for table lookup. LTE defaults to Rel-19.

Returns:

A list of LTE bands that include the given frequency. Empty list if not in any LTE band.

Raises:

ValueError – If the frequency is not an int and not a float, or out of range.

nrarfcn.get_band_by_lte_earfcn(earfcn: int, release_3gpp: int = 19) str

Gets the LTE band of a given EARFCN.

Parameters:
  • earfcn – The LTE EARFCN to get the band of.

  • release_3gpp – The 3GPP release to use for table lookup. LTE defaults to Rel-19.

Returns:

The LTE band of the given EARFCN.

Raises:

ValueError – If the LTE EARFCN is not valid.

nrarfcn.get_lte_earfcn_range(band: str | int, direction='', release_3gpp: int = 19) tuple

Gets the LTE EARFCN range for a given band.

Parameters:
  • band – The LTE band to get the range for, e.g. ‘B12’.

  • direction – ‘dl’ or ‘ul’ to get the downlink or uplink range. If not specified, ‘dl’ is used.

  • release_3gpp – The 3GPP release to use for table lookup. LTE defaults to Rel-19.

Returns:

A tuple with the min LTE EARFCN and max LTE EARFCN for the given band and direction.

Raises:

ValueError – If the given band is not a valid LTE band.