Metadata-Version: 2.4
Name: vyom-sutra
Version: 1.0.1
Summary: Fast Universal Similarity-Based Decision Engine
Author: Sanjok Thapa
License: MIT
Keywords: similarity,wave,decision,universal,fast,engine
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Android
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Games/Entertainment
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# Vyom Sutra

A wave-based decision engine.

Takes a value and a target.
Returns a similarity score.

## Install

pip install vyom-sutra

## Use

import vyom_sutra as vyom

r = vyom.score(value, target=1.2566, scale=1.0)
print(r['score'])      # 0 - 100
print(r['verdict'])    # "Clean" or "Noise"

## Output

score > 95   excellent
score > 80   clean
score > 50   weak
score < 50   noise

## Works with FFT

FFT splits a signal into frequencies.
Vyom scores each frequency.
Keep the clean ones. Drop the noise.

import numpy as np
import vyom_sutra as vyom

spectrum = np.fft.fft(signal)

for freq in spectrum:
    r = vyom.score(freq, target=1.2566)
    if r['clean']:
        print("keep", freq)

## Example 1: Medicine

Screening a drug compound.

Each compound has a weight (MW) and an oiliness (LogP).
These two numbers give a phase angle.
That angle is compared with the target protein angle.

import vyom_sutra as vyom

mw   = 463.9
logp = 2.8
target = 1.2566

phase = (mw / 500) * 1.1 + (logp / 5) * 0.5
r = vyom.score(phase, target=target)

if r['clean']:
    print("candidate")
else:
    print("reject")

Use case: filter a million compounds down to a
short list for the lab. Save months of time.

## Example 2: Cosmology

Testing a universe model against observed data.

For each scale k, the model predicts a value n_s.
Compare with the measured value from Planck 2018.

import vyom_sutra as vyom

measured_ns = 0.9649

for k in [5, 8, 12, 16]:
    model_ns = 1 - 2/60 + 0.0012 * (k - 5)
    r = vyom.score(model_ns, target=measured_ns, scale=1.0)
    print("k =", k, "score =", r['score'])

Use case: check how close a model is to real data.

## Example 3: Earthquake detection

A seismometer records ground motion.
Earthquake waves have a known shape (target).

  1. Read the sensor signal.
  2. FFT gives the frequencies.
  3. Vyom scores each frequency.
  4. Frequencies near target = earthquake.

import numpy as np
import vyom_sutra as vyom

signal   = read_seismometer()
spectrum = np.fft.fft(signal)

eq_target = 2.0
hits = 0

for freq in spectrum:
    r = vyom.score(freq, target=eq_target, scale=1.0)
    if r['clean']:
        hits += 1

if hits > 10:
    print("earthquake detected")
else:
    print("no earthquake")

Use case: separate a real quake from
traffic noise, wind, or a passing truck.

## Other sectors

The same function works anywhere a decision is needed.

  audio denoise       (FFT + Vyom)
  image compression   (DCT + Vyom)
  game NPC            (id -> behavior)
  finance signal      (price -> buy or sell)
  music note          (freq -> in tune or not)
  terrain height      (x, y -> noise filter)

Same one function.

## Dynamic scale

scale = 0.5   coarse
scale = 1.0   normal
scale = 5.0   fine
scale = 25.0  very fine

Any value works.

## Batch

values = [i * 0.001 for i in range(1000000)]
results = vyom.score_batch(values, target=1.2566)

## License

MIT
