8000 Added Benchmarking functions for scaling.py module by Naman-Priyadarshi · Pull Request #1445 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Added Benchmarking functions for scaling.py module #1445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added Benchmarking functions for
  • Loading branch information
Naman-Priyadarshi committed Apr 18, 2022
commit 65e6837368fda248005ab2df4616c95373140464
33 changes: 33 additions & 0 deletions benchmarks/benchmarks/scaling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
ASV benchmarks for scaling.py
"""

import pandas as pd
from pvlib import scaling
import numpy as np


class Scaling:

def setup(self):
self.n = 1000
lat = np.array((9.99, 10, 10.01))
lon = np.array((4.99, 5, 5.01))
self.coordinates = np.array([(lati, loni) for (lati, loni) in zip(lat, lon)])
self.times = pd.date_range('2019-01-01', freq='1T', periods=self.n)
self.positions = np.array([[0, 0], [100, 0], [100, 100], [0, 100]])
self.clearsky_index = pd.Series(np.random.rand(self.n), index=self.times)
self.cloud_speed = 5
self.tmscales = np.array((1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096))

def time_latlon_to_xy(self):
scaling.latlon_to_xy(self.coordinates)

def time__compute_wavelet(self):
scaling._compute_wavelet(self.clearsky_index, dt=1)

def time__compute_vr(self):
scaling._compute_vr(self.positions, self.cloud_speed, self.tmscales)

def time_wvm(self):
scaling.wvm(self.clearsky_index, self.positions, self.cloud_speed, dt=1)
0