Skip to content

reorder function arguments to put variables first and parameters second #197

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

Closed
wholmgren opened this issue Jun 23, 2016 · 3 comments
Closed
Labels
Milestone

Comments

@wholmgren
Copy link
Member

wholmgren commented Jun 23, 2016

I think we should reorder a handful of function arguments to put the most variable-like arguments first and most parameter-like arguments last. I'm guessing that a lot people will think that I'm just screwing with the API for no reason, but I do have a few reasons!

  1. consistency is important (and underrated)
  2. we can make better use of default arguments.

Here are the functions that I know about so far:

ashraeiam(b, aoi) ---> ashraeiam(aoi, b=0.05)

# updated to reflect Cliff's comment below
physicaliam(K, L, n, aoi) ---> physicaliam(aoi, n=1.526, K=4., L=0.002)

# see #200
singlediode(module, photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth) --->
singlediode(photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth)

# I just noticed that the matlab sapm api is very different. # see #198
sapm(module, poa_direct, poa_diffuse, temp_cell, airmass_absolute, aoi) ---> 
sapm(poa_direct, poa_diffuse, temp_cell, airmass_absolute, aoi, module)

snlinverter(inverter, v_dc, p_dc) ---> snlinverter(v_dc, p_dc, inverter)
@wholmgren wholmgren added the api label Jun 23, 2016
@wholmgren wholmgren added this to the 0.4.0 milestone Jun 23, 2016
@jforbess
Copy link
Contributor

While this is a pain, messing with the api, I do think it makes sense, and
is worthwhile going forward.

On Thu, Jun 23, 2016 at 10:04 AM, Will Holmgren [email protected]
wrote:

I think we should reorder a handful of function arguments to put the most
variable-like arguments first and most parameter-like arguments last. I'm
guessing that a lot people will think that I'm just screwing with the API
for no reason, but I do have a few reasons!

  1. consistency is important (and underrated)
  2. we can make better use of default arguments.

Here are the functions that I know about so far:

ashraeiam(b, aoi) --> ashraeiam(aoi, b=0.05)

physicaliam(K, L, n, aoi) --> physicaliam(aoi, K=4., L=0.002, n=1.526)

singlediode(module, photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth) -->
singlediode(photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth, module)

I just noticed that the matlab sapm api is very different, so that's another issue

sapm(module, poa_direct, poa_diffuse, temp_cell, airmass_absolute, aoi) -->
sapm(poa_direct, poa_diffuse, temp_cell, airmass_absolute, aoi, module)

snlinverter(inverter, v_dc, p_dc) --> snlinverter(v_dc, p_dc, inverter)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#197, or mute the thread
https://github.com/notifications/unsubscribe/AH66AYymLA_VB4jlhl2Rk5Ft6943zpFAks5qOryPgaJpZM4I9Bua
.

@cwhanse
Copy link
Member

cwhanse commented Jun 24, 2016

I agree, this effort makes sense in general. A few specific tweaks:
For physicaliam, I'd order as aoi, n, K, L. K and L can be safely set to the defaults as the function's values are almost entirely determined by n.
See my comment on #198 for the sapm.

@wholmgren
Copy link
Member Author

Good point, Cliff. I updated that line.

ref #200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants