@@ -154,7 +154,7 @@ ndf["lightcurve"] = ndf[["lightcurve.t", "lightcurve.mag", "lightcurve.magerr"]]
154154
155155# Extract features directly from the Arrow-backed nested column
156156feature = lc.Extractor(lc.Amplitude(), lc.EtaE(), lc.InterPercentileRange(quantile = 0.25 ))
157- result = feature.many(pa.array(ndf[" lightcurve" ]), sorted = True )
157+ result = feature.many(pa.array(ndf[" lightcurve" ]), n_jobs = - 1 )
158158
159159# Assign features back to the dataframe
160160ndf = ndf.assign(** dict (zip (feature.names, result.T)))
@@ -180,14 +180,14 @@ n_lc = 10
180180struct_type = pa.struct([(" t" , pa.float64()), (" m" , pa.float64()), (" sigma" , pa.float64())])
181181lcs_arrow = pa.array(
182182 [
183- [{" t" : t, " m" : m, " sigma" : s} for t, m, s in zip (* [rng.random(50 ) for _ in range (3 )])]
183+ [{" t" : t, " m" : m, " sigma" : s} for t, m, s in zip (* [np.sort( rng.random(50 ) ) for _ in range (3 )])]
184184 for _ in range (n_lc)
185185 ],
186186 type = pa.list_(struct_type),
187187)
188188
189189feature = lc.Extractor(lc.Kurtosis(), lc.Skew(), lc.ReducedChi2())
190- result = feature.many(lcs_arrow, sorted = True )
190+ result = feature.many(lcs_arrow, sorted = True , check = False , n_jobs = 4 )
191191print (f " Features: { feature.names} " )
192192print (f " Results shape: { result.shape} " )
193193```
@@ -208,7 +208,7 @@ rng = np.random.default_rng(42)
208208
209209# Start with a flat DataFrame, as you might get from a database or CSV
210210object_id = np.repeat(np.arange(10 ), 50 )
211- t = rng.random(500 )
211+ t = np.sort( rng.random(500 ) )
212212m = rng.random(500 )
213213sigma = rng.random(500 )
214214
@@ -218,7 +218,7 @@ df = pl.DataFrame({"object_id": object_id, "t": t, "m": m, "sigma": sigma})
218218nested = df.group_by(" object_id" ).agg(pl.struct(" t" , " m" , " sigma" ).alias(" lc" ))
219219
220220feature = lc.Extractor(lc.Amplitude(), lc.BeyondNStd(nstd = 2 ), lc.LinearFit(), lc.StetsonK())
221- result = feature.many(nested[" lc" ], sorted = True )
221+ result = feature.many(nested[" lc" ], sorted = True , check = False , n_jobs = 1 )
222222
223223# Join feature columns back to the nested DataFrame
224224nested = nested.with_columns(
0 commit comments