5.3.3.1. gemini_application.esp.esp

ESP application for pump performance analysis and pump curve generation.

Classes

ESPApp()

Class for application ESP calculation.

class gemini_application.esp.esp.ESPApp[source]

Bases: ApplicationAbstract

Class for application ESP calculation.

Initialize ESP application.

calculate()[source]

Calculate IPR, VLP, ESP.

calculate_pump_head_curve()[source]

Calculate ESP output.

calibrate_esp_head_simple()[source]

Calibrate ESP head using simple method.

filter_sensor_data(df)[source]

Filter sensor data to remove unphysical values.

This follows the same thresholds as used in the training pipeline.

get_data()[source]

Get ESP data.

get_sensor_data_failure_prediction()[source]

Get all sensor data required for failure prediction from database.

init_parameters()[source]

Initialize model parameters.

plot()[source]

Plot pump curves and the measured data.

plot_comparison()[source]

Plot the measured and calculated tags.

plot_failure_prediction()[source]

Plot failure prediction probability over time.

The plot shows: - Probability of failure occurring within the next 30 days from each timestamp - Horizontal bands for risk zones (High/Moderate/Low) - A dashed vertical line at the selected time in forward mode

Modes:
  • “forward”: x-axis is a 60-day window (30 days before and 30 days after the selected time), with a dashed line at the selected time.

  • “historical”: shows the full available period.

plot_features()[source]

Plot key ESP sensor features over time.

predict_failures(model_path=None, prediction_mode='forward')[source]

Predict failures using ML model based on sensor data.

This function follows the exact preprocessing pipeline from training the model: 1. Filter unphysical values 2. Calculate Vibration from components 3. Apply rolling window average (96 points = 4 days for 1-hour data) 4. Extract 7 relevant features 5. Scale features using StandardScaler 6. Make predictions using HistGradientBoostingClassifier

Parameters:
  • model_path – Path to the ML model pickle file.

  • prediction_mode – Mode of prediction: - “forward”: Show 60-day window (30 days before + 30 days after selected time) - “historical”: Analyze entire historical period