Metadata-Version: 2.4
Name: shivs_per_lib
Version: 1.1.3
Summary: A personal utility package by Shivsamb Harkare.
Author: Shivsamb Mangalkumar Harkare
Author-email: shivsamb1984@gmail.com
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: pandas
Requires-Dist: matplotlib
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# shivs_per_lib

A Python utility library developed by **Shivsamb Harkare (COEP Technological University)** for engineering, embedded systems, digital electronics, signal processing, control systems, AI/ML, and software development applications.

The goal of this library is to provide a collection of commonly used engineering calculations, signal processing utilities, machine learning helpers, and embedded-system tools in a single easy-to-use package.

---

# Installation

```bash
pip install shivs_per_lib
```

---

# Modules Overview

The library contains functions from the following domains:

* Digital Electronics
* DSP (Digital Signal Processing)
* Control Systems
* Embedded Systems
* AI & Machine Learning
* EDA (Exploratory Data Analysis)
* Software Development Utilities

---

# Digital Electronics

## q_mc()

Implements the Quine-McCluskey Boolean minimization algorithm.

### Purpose

Used to simplify Boolean expressions and minimize logic circuits.

### Example

```python
from shivs_per_lib import q_mc

q_mc()
```

The function asks for:

* Minterms
* Don't-care terms
* Number of variables

and outputs the simplified Boolean expression.

---

## binary_to_gray()

Converts a binary number into Gray code.

### Example

```python
binary_to_gray("1010")
```

Output:

```python
1111
```

### Applications

* Rotary encoders
* Digital communication
* Error reduction systems

---

## binary_to_decimal()

Converts binary to decimal.

```python
binary_to_decimal("1010")
```

Output:

```python
10
```

---

## decimal_to_binary()

Converts decimal to binary.

```python
decimal_to_binary(10)
```

Output:

```python
1010
```

---

# DSP Functions

## fft_analysis()

Performs Fast Fourier Transform analysis.

### Example

```python
freq, magnitude = fft_analysis(signal, 1000)
```

### Returns

* Frequency components
* FFT magnitude spectrum

### Applications

* Vibration analysis
* Audio processing
* Biomedical signals
* IMU analysis

---

## butter_lowpass()

Applies Butterworth low-pass filtering.

### Example

```python
filtered = butter_lowpass(
    signal,
    cutoff=20,
    fs=100
)
```

### Applications

* Sensor noise removal
* ECG filtering
* IMU preprocessing

---

## butter_highpass()

Applies Butterworth high-pass filtering.

### Example

```python
filtered = butter_highpass(
    signal,
    cutoff=1,
    fs=100
)
```

---

## moving_average()

Smooths signals using moving average filtering.

### Example

```python
moving_average(signal, window=5)
```

---

## rms()

Computes Root Mean Square value.

### Example

```python
rms(signal)
```

### Applications

* Power calculations
* Vibration analysis
* Signal energy estimation

---

# Control Systems

## pid_control()

Implements PID control calculations.

### Example

```python
output, integral, error = pid_control(
    setpoint=100,
    measured=95,
    kp=1.2,
    ki=0.3,
    kd=0.1,
    integral=0,
    prev_error=0,
    dt=0.01
)
```

### Applications

* Temperature control
* Motor speed control
* Process automation

---

## first_order_response()

Calculates first-order system response.

```python
first_order_response(
    K=1,
    tau=2,
    time=t
)
```

---

## percent_overshoot()

Calculates percentage overshoot.

```python
percent_overshoot(peak=120, final=100)
```

Output:

```python
20
```

---

## steady_state_error()

Computes steady-state error.

```python
steady_state_error(
    reference=100,
    output=98
)
```

Output:

```python
2
```

---

# Embedded Systems

## adc_to_voltage()

Converts ADC counts to voltage.

```python
adc_to_voltage(
    adc_value=2048,
    resolution=12,
    vref=3.3
)
```

---

## voltage_divider()

Calculates voltage divider output.

```python
voltage_divider(
    vin=12,
    r1=1000,
    r2=1000
)
```

Output:

```python
6V
```

---

## ohms_law()

Solves Ohm's Law.

```python
ohms_law(v=12, r=4)
```

Output:

```python
3A
```

---

## pwm_duty_cycle()

Calculates PWM duty cycle.

```python
pwm_duty_cycle(
    on_time=2,
    period=10
)
```

Output:

```python
20%
```

---

## timer_frequency()

Calculates timer frequency.

```python
timer_frequency(
    16000000,
    64
)
```

---

## uart_tx_time()

Computes UART transmission time.

```python
uart_tx_time(
    bytes_count=100,
    baudrate=9600
)
```

---

## battery_runtime()

Estimates battery runtime.

```python
battery_runtime(
    2000,
    500
)
```

Output:

```python
4 Hours
```

---

## crc8()

Computes CRC-8 checksum.

```python
crc8([1,2,3,4])
```

### Applications

* Communication protocols
* Error detection
* Embedded systems

---

## debounce()

Debounces noisy digital signals.

```python
debounce(samples)
```

---

## byte_to_hex()

Converts byte to hexadecimal.

```python
byte_to_hex(255)
```

Output:

```python
0xff
```

---

## hex_to_binary()

Converts hexadecimal to binary.

```python
hex_to_binary("FF")
```

---

## swap_endian_16()

Swaps endianness of a 16-bit value.

```python
swap_endian_16(0x1234)
```

Output:

```python
0x3412
```

---

# AI & Machine Learning

## normalize()

Performs Z-score normalization.

```python
normalize(data)
```

---

## minmax_normalize()

Performs Min-Max normalization.

```python
minmax_normalize(data)
```

---

## sliding_window()

Creates overlapping windows.

```python
sliding_window(
    data,
    window_size=128,
    step=64
)
```

### Applications

* Gait analysis
* HAR systems
* Time-series ML

---

## quaternion_magnitude()

Computes quaternion magnitude.

```python
quaternion_magnitude(
    w,x,y,z
)
```

---

## train_test_split()

Randomly splits data.

```python
train_test_split(
    data,
    test_size=0.2
)
```

---

## accuracy_score()

Computes classification accuracy.

```python
accuracy_score(
    y_true,
    y_pred
)
```

---

## mae()

Computes Mean Absolute Error.

```python
mae(
    y_true,
    y_pred
)
```

---

## confusion_matrix()

Creates confusion matrix metrics.

```python
confusion_matrix(
    y_true,
    y_pred
)
```

Returns:

```python
{
    "TP": ...,
    "TN": ...,
    "FP": ...,
    "FN": ...
}
```

---

## missing_percentage()

Computes percentage of missing values.

```python
missing_percentage(data)
```

---

## outliers_iqr()

Detects outliers using IQR.

```python
outliers_iqr(data)
```

---

# Exploratory Data Analysis

## eda_plot()

Universal plotting function.

### Supported Plots

* hist
* box
* scatter
* line
* bar

### Example

```python
eda_plot(
    df,
    plot_type="scatter",
    col1="Height",
    col2="Weight"
)
```

---

## data_overview()

Provides a quick dataset summary.

```python
data_overview(df)
```

Returns:

```python
{
    "rows": ...,
    "columns": ...,
    "missing_values": ...,
    "duplicates": ...
}
```

---

## quick_report()

Prints a quick EDA report.

```python
quick_report(df)
```

Displays:

* Rows
* Columns
* Missing values
* Duplicates
* Column names

---

# Software Development Utilities

## password_strength()

Evaluates password strength.

```python
password_strength(
    "MyPassword123!"
)
```

Returns a score from 0 to 4.

---

## validate_email()

Validates email format.

```python
validate_email(
    "user@example.com"
)
```

Returns:

```python
True
```

---

## timer()

Function execution timer decorator.

```python
@timer
def my_function():
    pass
```

Output:

```python
my_function took 0.1234 sec
```

---

# Developed By

**Shivsamb Harkare**
B.Tech Instrumentation & Control Engineering
COEP Technological University

Focused on:

* Embedded Systems
* Artificial Intelligence & Machine Learning
* Signal Processing
* Control Systems
* Healthcare Technology
* Gait Analysis & Human Activity Recognition

If you find this package useful, feel free to contribute and suggest new engineering utilities.
