ankostis / wltp

Undefined name detected PYL-E0602
Bug risk
Critical
46 occurrences in this check
Undefined variable 'gnames'
234    ):
235        gids = sorted(gids)
236        gids = pd.Series({i: generator(i) for i in gids})
237        return GearMultiIndexer(items, gnames, gids[-1], generator)238
239    @classmethod
240    @autog.autographed(
Undefined variable 'calcEngineRevs_required'
691    p_safety_margin = mdl["f_safety_margin"]
692    v_stopped_threshold = mdl["v_stopped_threshold"]
693
694    (_N_GEARS, _GEARS, _GEAR_RATIOS) = calcEngineRevs_required(695        V, n2v_ratios, n_idle, v_stopped_threshold
696    )
697
Undefined variable 'possibleGears_byEngineRevs'
695        V, n2v_ratios, n_idle, v_stopped_threshold
696    )
697
698    (_G_BY_N, CLUTCH) = possibleGears_byEngineRevs(699        V,
700        A,
701        _N_GEARS,
Undefined variable 'possibleGears_byPower'
708        driveability_issues,
709    )
710
711    (_G_BY_P, _P_AVAILS, _N_NORMS) = possibleGears_byPower(712        _N_GEARS,
713        P_REQ,
714        n_idle,
Undefined variable '_shapes'
721
722    assert (
723        _GEAR_RATIOS.shape == _N_GEARS.shape == _P_AVAILS.shape == _N_NORMS.shape
724    ), _shapes(_GEAR_RATIOS, _N_GEARS, _P_AVAILS, _N_NORMS)725
726    GEARS = selectGears(_GEARS, _G_BY_N, _G_BY_P, driveability_issues)
727    CLUTCH[(GEARS == 2) & (_N_GEARS[1, :] < n_clutch_gear2)] = True
Undefined variable 'selectGears'
723        _GEAR_RATIOS.shape == _N_GEARS.shape == _P_AVAILS.shape == _N_NORMS.shape
724    ), _shapes(_GEAR_RATIOS, _N_GEARS, _P_AVAILS, _N_NORMS)
725
726    GEARS = selectGears(_GEARS, _G_BY_N, _G_BY_P, driveability_issues)727    CLUTCH[(GEARS == 2) & (_N_GEARS[1, :] < n_clutch_gear2)] = True
728
729    assert V.shape == GEARS.shape, _shapes(V, GEARS)
Undefined variable '_shapes'
726    GEARS = selectGears(_GEARS, _G_BY_N, _G_BY_P, driveability_issues)
727    CLUTCH[(GEARS == 2) & (_N_GEARS[1, :] < n_clutch_gear2)] = True
728
729    assert V.shape == GEARS.shape, _shapes(V, GEARS)730    assert GEARS.shape == CLUTCH.shape == driveability_issues.shape, _shapes(
731        GEARS, CLUTCH.shape, driveability_issues
732    )
Undefined variable '_shapes'
727    CLUTCH[(GEARS == 2) & (_N_GEARS[1, :] < n_clutch_gear2)] = True
728
729    assert V.shape == GEARS.shape, _shapes(V, GEARS)
730    assert GEARS.shape == CLUTCH.shape == driveability_issues.shape, _shapes(731        GEARS, CLUTCH.shape, driveability_issues
732    )
733    assert "i" == GEARS.dtype.kind, GEARS.dtype
Undefined variable 'display'
249
250rec = vmax.calc_v_max(gwots)
251print(f"VMAX: {rec.v_max}, G_VMAX: {rec.g_vmax}, maxWOT? {rec.is_n_lim}")
252display(rec.wot[f"g{rec.g_vmax}"])253
254# %% [markdown]
255# # Museum
Undefined variable 'display'
200    v_max_ac = ac_props["v_max"]
201    v_max = py_props["v_max"]
202    # display(gwots['g5'].dropna())
203    display(gwots.loc[v_max - offset : v_max + offset, f"g{g}"])204
205
206disp_gwots(ac_props, py_props, gwots, 6)
Undefined variable 'display'
171ac_props, py_props, wot, gwots, n2vs = read_veh(caseno)
172
173# %%
174display(wot)175
176
177# %%
Undefined variable 'display'
159    py_props, _, gwots = vehdb.load_vehicle_pyalgo(out_h5fname, vehnum)
160
161    if not silent:
162        display(ac_props[["no_of_gears", "gear_v_max", "v_max"]], "", py_props)163        ax = None
164        ax = gwots.loc[:, ("g6 g5 g4".split(), "p_avail")].plot(ax=ax)
165        gwots.loc[:, ("g6 g5 g4".split(), "p_resist")].plot(ax=ax)
Undefined variable 'display'
141    v_max_ac = ac_props["v_max"]
142    v_max = py_props["v_max"]
143    # display(gwots['g5'].dropna())
144    display(gwots.loc[v_max - offset : v_max + offset, f"g{g}"])145
146
147disp_gwots(ac_props, py_props, gwots, 6)
Undefined variable 'display'
102ac_props, py_props, wot, gwots = read_veh(caseno)
103
104# %%
105display(wot)106
107
108# %%
Undefined variable 'display'
 90    py_props, _, gwots = vehdb.load_vehicle_pyalgo(out_h5fname, vehnum)
 91
 92    if not silent:
 93        display(ac_props[["no_of_gears", "gear_v_max", "v_max"]], "", py_props) 94        ax = None
 95        ax = gwots.loc[:, ("g6 g5 g4".split(), "p_avail")].plot(ax=ax)
 96        gwots.loc[:, ("g6 g5 g4".split(), "p_resist")].plot(ax=ax)
Undefined variable 'display'
184}
185
186pprint(oprops)
187display(mdl["cycle"])188
189# %%
190print(sorted(mdl.keys()))
Undefined variable 'display'
228out_mdl = exp.run()
229print(f"Available values: \n{list(out_mdl.keys())}")
230print(f"Cycle: ")
231display(out_mdl["cycle"])
Undefined variable 'display'
146}
147
148pprint(oprops)
149display(mdl["cycle"])150
151# %% [markdown]
152# ## Run a case from AccDb
Undefined variable 'scale_results'
381display(phase_sums.sample(nsamples).sort_index())
382
383# %%
384case_traces = {i.case: i.ApplicableTrace for i in scale_results}385case_traces = pd.concat(
386    case_traces.values(), keys=case_traces.keys(), names=["case", "t"]
387)
378    "lengths": merge_phase_numbers(scale_results, "DistanceCompensatedPhaseLengths"),
379}
380phase_sums = pd.concat(phase_sums.values(), axis=1, keys=phase_sums.keys())
381display(phase_sums.sample(nsamples).sort_index())382
383# %%
384case_traces = {i.case: i.ApplicableTrace for i in scale_results}
Undefined variable 'scale_results'
375
376phase_sums = {
377    "checksums": merge_phase_numbers(scale_results, "PhaseChecksums"),
378    "lengths": merge_phase_numbers(scale_results, "DistanceCompensatedPhaseLengths"),379}
380phase_sums = pd.concat(phase_sums.values(), axis=1, keys=phase_sums.keys())
381display(phase_sums.sample(nsamples).sort_index())
Undefined variable 'scale_results'
374
375
376phase_sums = {
377    "checksums": merge_phase_numbers(scale_results, "PhaseChecksums"),378    "lengths": merge_phase_numbers(scale_results, "DistanceCompensatedPhaseLengths"),
379}
380phase_sums = pd.concat(phase_sums.values(), axis=1, keys=phase_sums.keys())
359).set_index("case")
360
361
362display(scale_scalars.sample(nsamples).sort_index())363
364
365# %%
Undefined variable 'scale_results'
354    f for f in scale_results[0]._fields if f not in non_scalar_scale_fields
355]
356scale_scalars = pd.DataFrame(
357    [[getattr(res, k) for k in scalar_scale_fields] for res in scale_results],358    columns=scalar_scale_fields,
359).set_index("case")
360
Undefined variable 'scale_results'
351    "PhaseChecksums DistanceCompensatedPhaseLengths OriginalTrace ApplicableTrace".split()
352)
353scalar_scale_fields = [
354    f for f in scale_results[0]._fields if f not in non_scalar_scale_fields355]
356scale_scalars = pd.DataFrame(
357    [[getattr(res, k) for k in scalar_scale_fields] for res in scale_results],