Skip to content
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

Refine nametuple tutorial #1071

Closed

Conversation

Parth-Vachhani
Copy link

  • Describe your pull request as transparent as possible
    • What functionality does it implement?
    • Where is it located?
    • How does the API look?
    • ...
  • Related issues?
  • Share your knowledge: Insights/Remarks
  • Other comments and questions
  • For new features: Remember the documentation!

p-snft and others added 30 commits January 23, 2024 11:14
This is not really "basic" and can lead to errors. I still left it in
and put some additional explanation so that beginners learn about the
concept but do not have it in their code without thinking about it.
Set oemof.network requirement to stable release
We require the experimental feature warning.
I think it will increase maintainability if we do not have to care for compatibility with Pandas 1.x. (I used new features for a solph tutorial and people had unexpected problems because of unsupported features in their Pandas installation.)
Explicitly pass `custom_properties` to `network.Node` class
Although it is just an example, having hard-coded unreachable
code can be considered bad style.
Co-authored-by: Patrik Schönfeldt <github@patrikschoenfeldt.de>
Co-authored-by: Patrik Schönfeldt <github@patrikschoenfeldt.de>
Improved variable naming and formatting in 'basic_example.py' for enh…
Deactivate dump/restore in basic example
…etConverter

Multiple Outputs for OffsetConverter
I did not touch the multi-period-model as I think the constraint for
this (experimental) mode needs refactoring anyway.
@Parth-Vachhani Parth-Vachhani reopened this Aug 7, 2024
@Parth-Vachhani Parth-Vachhani marked this pull request as ready for review August 7, 2024 09:29
Parth-Vachhani and others added 12 commits August 7, 2024 11:35
The auto-stretch feature of the _Sequence contained hidden magic,
as it tracked the last "entry" that has been accessed and pretended
to have a length based on this. So, outcomes depend on something that
is assumed to be a read access. Also, self.data was erived from UserList
but never really supported all of the expected functionality in a
consistent way.

The new _FakeSequence is a lot simpler. In particular it has an explicit
(fake) length that needs to be set before casting to (stretched) lists.
The default length is still set, because there is an entry, and to allow
to directly iterate over a _FakeSequence, e.g. in sum().
To allow this, some checks need to more explicit, now. As solph.sequence
will return a _FakeSequence or a numpy.array, other members of
_FakeSequence mimic the API of numpy.array. In particular, this allows
min/max/sum operations in constant time.
We can test for the _FakeSequence class to see that
something really is a scalar.
…uence

Replace _Sequence by _FakeSequence
@p-snft p-snft marked this pull request as draft August 16, 2024 08:46
@p-snft p-snft closed this Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants