Decorator transforming a python function in a Transformer that can be pipelined to C++ algorithms in a SQLamarr.Pipeline
.
Example.
import SQLamarr
import pandas as pd
db = SQLamarr.SQLite3DB().seed(42)
loader = SQLamarr.HepMC2DataLoader(db)
pv_finder = SQLamarr.PVFinder(db)
mcps = SQLamarr.MCParticleSelector(db)
@SQLamarr.PyTransformer(db)
def selector (connection):
df = pd.read_sql_query("SELECT * FROM MCParticles", connection)
df = df[df.pz > 10000] # Apply a selection
df.to_sql("MCParticles", connection, if_exists='replace')
pipeline = SQLamarr.Pipeline((pv_finder, mcps, selector))
loader.load("my_file_0.mc2", 42, 0)
pipeline.execute()
loader.load("my_file_1.mc2", 42, 1)
pipeline.execute()
Definition at line 12 of file PyTransformer.py.