DavMelchi commited on
Commit
00554ac
·
1 Parent(s): 1571e78

Add TDD band support to CIQ 4G Generator with L2300 band configuration, implement non-breaking space stripping in integer parsing, update default band blocks to include L700/L2300, add TDD_BANDS set for conditional UL EARFCN omission, extend 4x4 MIMO mode assignment to L2300, and refactor output column builder to skip UL EARFCN columns for TDD bands

Browse files
Files changed (1) hide show
  1. queries/process_ciq_4g.py +24 -15
queries/process_ciq_4g.py CHANGED
@@ -4,8 +4,15 @@ from typing import Optional
4
 
5
  import pandas as pd
6
 
 
 
 
7
 
8
  def _parse_int(value: object) -> Optional[int]:
 
 
 
 
9
  v = pd.to_numeric(value, errors="coerce")
10
  if pd.isna(v):
11
  return None
@@ -50,7 +57,7 @@ def _sector_from_cell_name(cell_name: object) -> Optional[int]:
50
 
51
 
52
  def _dl_mimo_mode_for_band(band: str) -> str:
53
- if band in {"L2600"}:
54
  return "4x4"
55
  return "2x2"
56
 
@@ -72,7 +79,7 @@ def _build_output_columns(band_blocks: list[str]) -> list[str]:
72
  ]
73
 
74
  cell_idx = 1
75
- for band_block_idx, _ in enumerate(band_blocks, start=1):
76
  for _slot in range(4):
77
  cols.extend(
78
  [
@@ -85,15 +92,16 @@ def _build_output_columns(band_blocks: list[str]) -> list[str]:
85
  )
86
  cell_idx += 1
87
 
88
- cols.extend(
89
- [
90
- f"$tac{band_block_idx}",
91
- f"$dlMimoMode{band_block_idx}",
92
- f"$ChBw{band_block_idx}",
93
- f"$dlearfcnlte{band_block_idx}",
94
- f"$ulearfcnlte{band_block_idx}",
95
- ]
96
- )
 
97
 
98
  return cols
99
 
@@ -133,7 +141,7 @@ def generate_ciq_4g_sheet(
133
  lte_max_power: int = 460,
134
  ) -> pd.DataFrame:
135
  if band_blocks is None:
136
- band_blocks = ["L800", "L1800", "L2600"]
137
 
138
  output_cols = _build_output_columns(band_blocks)
139
 
@@ -195,9 +203,10 @@ def generate_ciq_4g_sheet(
195
  row_map[f"$dlMimoMode{block_idx}"] = _dl_mimo_mode_for_band(band)
196
  row_map[f"$ChBw{block_idx}"] = int(ch_bw)
197
  row_map[f"$dlearfcnlte{block_idx}"] = dl_earfcn
198
- row_map[f"$ulearfcnlte{block_idx}"] = (
199
- _ul_earfcn_from_dl(dl_earfcn) if dl_earfcn is not None else None
200
- )
 
201
 
202
  rows_out.append([row_map.get(c) for c in output_cols])
203
 
 
4
 
5
  import pandas as pd
6
 
7
+ DEFAULT_BAND_BLOCKS = ["L800", "L1800", "L2600", "L700", "L2300"]
8
+ TDD_BANDS = {"L2300"}
9
+
10
 
11
  def _parse_int(value: object) -> Optional[int]:
12
+ if isinstance(value, str):
13
+ cleaned = value.replace("\u00a0", " ").strip()
14
+ value = cleaned
15
+
16
  v = pd.to_numeric(value, errors="coerce")
17
  if pd.isna(v):
18
  return None
 
57
 
58
 
59
  def _dl_mimo_mode_for_band(band: str) -> str:
60
+ if band in {"L2600", "L2300"}:
61
  return "4x4"
62
  return "2x2"
63
 
 
79
  ]
80
 
81
  cell_idx = 1
82
+ for band_block_idx, band in enumerate(band_blocks, start=1):
83
  for _slot in range(4):
84
  cols.extend(
85
  [
 
92
  )
93
  cell_idx += 1
94
 
95
+ block_cols = [
96
+ f"$tac{band_block_idx}",
97
+ f"$dlMimoMode{band_block_idx}",
98
+ f"$ChBw{band_block_idx}",
99
+ f"$dlearfcnlte{band_block_idx}",
100
+ ]
101
+ if band not in TDD_BANDS:
102
+ block_cols.append(f"$ulearfcnlte{band_block_idx}")
103
+
104
+ cols.extend(block_cols)
105
 
106
  return cols
107
 
 
141
  lte_max_power: int = 460,
142
  ) -> pd.DataFrame:
143
  if band_blocks is None:
144
+ band_blocks = DEFAULT_BAND_BLOCKS.copy()
145
 
146
  output_cols = _build_output_columns(band_blocks)
147
 
 
203
  row_map[f"$dlMimoMode{block_idx}"] = _dl_mimo_mode_for_band(band)
204
  row_map[f"$ChBw{block_idx}"] = int(ch_bw)
205
  row_map[f"$dlearfcnlte{block_idx}"] = dl_earfcn
206
+ if band not in TDD_BANDS:
207
+ row_map[f"$ulearfcnlte{block_idx}"] = (
208
+ _ul_earfcn_from_dl(dl_earfcn) if dl_earfcn is not None else None
209
+ )
210
 
211
  rows_out.append([row_map.get(c) for c in output_cols])
212