flixopt 2.2.0b0__py3-none-any.whl → 2.2.0rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flixopt might be problematic. Click here for more details.

Files changed (48) hide show
  1. docs/examples/00-Minimal Example.md +1 -1
  2. docs/examples/01-Basic Example.md +1 -1
  3. docs/examples/02-Complex Example.md +1 -1
  4. docs/examples/index.md +1 -1
  5. docs/faq/contribute.md +26 -14
  6. docs/faq/index.md +1 -1
  7. docs/javascripts/mathjax.js +1 -1
  8. docs/user-guide/Mathematical Notation/Bus.md +1 -1
  9. docs/user-guide/Mathematical Notation/Effects, Penalty & Objective.md +13 -13
  10. docs/user-guide/Mathematical Notation/Flow.md +1 -1
  11. docs/user-guide/Mathematical Notation/LinearConverter.md +2 -2
  12. docs/user-guide/Mathematical Notation/Piecewise.md +1 -1
  13. docs/user-guide/Mathematical Notation/Storage.md +1 -1
  14. docs/user-guide/Mathematical Notation/index.md +1 -1
  15. docs/user-guide/Mathematical Notation/others.md +1 -1
  16. docs/user-guide/index.md +2 -2
  17. flixopt/__init__.py +5 -0
  18. flixopt/aggregation.py +0 -1
  19. flixopt/calculation.py +40 -72
  20. flixopt/commons.py +10 -1
  21. flixopt/components.py +326 -154
  22. flixopt/core.py +459 -966
  23. flixopt/effects.py +67 -270
  24. flixopt/elements.py +76 -84
  25. flixopt/features.py +172 -154
  26. flixopt/flow_system.py +70 -99
  27. flixopt/interface.py +315 -147
  28. flixopt/io.py +27 -56
  29. flixopt/linear_converters.py +3 -3
  30. flixopt/network_app.py +755 -0
  31. flixopt/plotting.py +16 -34
  32. flixopt/results.py +108 -806
  33. flixopt/structure.py +11 -67
  34. flixopt/utils.py +9 -6
  35. {flixopt-2.2.0b0.dist-info → flixopt-2.2.0rc2.dist-info}/METADATA +63 -42
  36. flixopt-2.2.0rc2.dist-info/RECORD +54 -0
  37. {flixopt-2.2.0b0.dist-info → flixopt-2.2.0rc2.dist-info}/WHEEL +1 -1
  38. scripts/extract_release_notes.py +45 -0
  39. docs/release-notes/_template.txt +0 -32
  40. docs/release-notes/index.md +0 -7
  41. docs/release-notes/v2.0.0.md +0 -93
  42. docs/release-notes/v2.0.1.md +0 -12
  43. docs/release-notes/v2.1.0.md +0 -31
  44. docs/release-notes/v2.2.0.md +0 -55
  45. docs/user-guide/Mathematical Notation/Investment.md +0 -115
  46. flixopt-2.2.0b0.dist-info/RECORD +0 -59
  47. {flixopt-2.2.0b0.dist-info → flixopt-2.2.0rc2.dist-info}/licenses/LICENSE +0 -0
  48. {flixopt-2.2.0b0.dist-info → flixopt-2.2.0rc2.dist-info}/top_level.txt +0 -0
flixopt/plotting.py CHANGED
@@ -209,7 +209,7 @@ class ColorProcessor:
209
209
 
210
210
  def with_plotly(
211
211
  data: pd.DataFrame,
212
- style: Literal['stacked_bar', 'line', 'area', 'grouped_bar'] = 'stacked_bar',
212
+ mode: Literal['bar', 'line', 'area'] = 'area',
213
213
  colors: ColorType = 'viridis',
214
214
  title: str = '',
215
215
  ylabel: str = '',
@@ -222,7 +222,7 @@ def with_plotly(
222
222
  Args:
223
223
  data: A DataFrame containing the data to plot, where the index represents time (e.g., hours),
224
224
  and each column represents a separate data series.
225
- style: The plotting style. Use 'stacked_bar' for stacked bar charts, 'line' for stepped lines,
225
+ mode: The plotting mode. Use 'bar' for stacked bar charts, 'line' for stepped lines,
226
226
  or 'area' for stacked area charts.
227
227
  colors: Color specification, can be:
228
228
  - A string with a colorscale name (e.g., 'viridis', 'plasma')
@@ -235,8 +235,7 @@ def with_plotly(
235
235
  Returns:
236
236
  A Plotly figure object containing the generated plot.
237
237
  """
238
- if style not in ['stacked_bar', 'line', 'area', 'grouped_bar']:
239
- raise ValueError(f"'style' must be one of {['stacked_bar', 'line', 'area', 'grouped_bar']}")
238
+ assert mode in ['bar', 'line', 'area'], f"'mode' must be one of {['bar', 'line', 'area']}"
240
239
  if data.empty:
241
240
  return go.Figure()
242
241
 
@@ -244,40 +243,23 @@ def with_plotly(
244
243
 
245
244
  fig = fig if fig is not None else go.Figure()
246
245
 
247
- if style == 'stacked_bar':
246
+ if mode == 'bar':
248
247
  for i, column in enumerate(data.columns):
249
248
  fig.add_trace(
250
249
  go.Bar(
251
250
  x=data.index,
252
251
  y=data[column],
253
252
  name=column,
254
- marker=dict(color=processed_colors[i],
255
- line=dict(width=0, color='rgba(0,0,0,0)')), #Transparent line with 0 width
253
+ marker=dict(color=processed_colors[i]),
256
254
  )
257
255
  )
258
256
 
259
257
  fig.update_layout(
260
- barmode='relative',
258
+ barmode='relative' if mode == 'bar' else None,
261
259
  bargap=0, # No space between bars
262
- bargroupgap=0, # No space between grouped bars
260
+ bargroupgap=0, # No space between groups of bars
263
261
  )
264
- if style == 'grouped_bar':
265
- for i, column in enumerate(data.columns):
266
- fig.add_trace(
267
- go.Bar(
268
- x=data.index,
269
- y=data[column],
270
- name=column,
271
- marker=dict(color=processed_colors[i])
272
- )
273
- )
274
-
275
- fig.update_layout(
276
- barmode='group',
277
- bargap=0.2, # No space between bars
278
- bargroupgap=0, # space between grouped bars
279
- )
280
- elif style == 'line':
262
+ elif mode == 'line':
281
263
  for i, column in enumerate(data.columns):
282
264
  fig.add_trace(
283
265
  go.Scatter(
@@ -288,7 +270,7 @@ def with_plotly(
288
270
  line=dict(shape='hv', color=processed_colors[i]),
289
271
  )
290
272
  )
291
- elif style == 'area':
273
+ elif mode == 'area':
292
274
  data = data.copy()
293
275
  data[(data > -1e-5) & (data < 1e-5)] = 0 # Preventing issues with plotting
294
276
  # Split columns into positive, negative, and mixed categories
@@ -363,7 +345,7 @@ def with_plotly(
363
345
 
364
346
  def with_matplotlib(
365
347
  data: pd.DataFrame,
366
- style: Literal['stacked_bar', 'line'] = 'stacked_bar',
348
+ mode: Literal['bar', 'line'] = 'bar',
367
349
  colors: ColorType = 'viridis',
368
350
  title: str = '',
369
351
  ylabel: str = '',
@@ -378,7 +360,7 @@ def with_matplotlib(
378
360
  Args:
379
361
  data: A DataFrame containing the data to plot. The index should represent time (e.g., hours),
380
362
  and each column represents a separate data series.
381
- style: Plotting style. Use 'stacked_bar' for stacked bar charts or 'line' for stepped lines.
363
+ mode: Plotting mode. Use 'bar' for stacked bar charts or 'line' for stepped lines.
382
364
  colors: Color specification, can be:
383
365
  - A string with a colormap name (e.g., 'viridis', 'plasma')
384
366
  - A list of color strings (e.g., ['#ff0000', '#00ff00'])
@@ -394,19 +376,19 @@ def with_matplotlib(
394
376
  A tuple containing the Matplotlib figure and axes objects used for the plot.
395
377
 
396
378
  Notes:
397
- - If `style` is 'stacked_bar', bars are stacked for both positive and negative values.
379
+ - If `mode` is 'bar', bars are stacked for both positive and negative values.
398
380
  Negative values are stacked separately without extra labels in the legend.
399
- - If `style` is 'line', stepped lines are drawn for each data series.
381
+ - If `mode` is 'line', stepped lines are drawn for each data series.
400
382
  - The legend is placed below the plot to accommodate multiple data series.
401
383
  """
402
- assert style in ['stacked_bar', 'line'], f"'style' must be one of {['stacked_bar', 'line']} for matplotlib"
384
+ assert mode in ['bar', 'line'], f"'mode' must be one of {['bar', 'line']} for matplotlib"
403
385
 
404
386
  if fig is None or ax is None:
405
387
  fig, ax = plt.subplots(figsize=figsize)
406
388
 
407
389
  processed_colors = ColorProcessor(engine='matplotlib').process_colors(colors, list(data.columns))
408
390
 
409
- if style == 'stacked_bar':
391
+ if mode == 'bar':
410
392
  cumulative_positive = np.zeros(len(data))
411
393
  cumulative_negative = np.zeros(len(data))
412
394
  width = data.index.to_series().diff().dropna().min() # Minimum time difference
@@ -437,7 +419,7 @@ def with_matplotlib(
437
419
  )
438
420
  cumulative_negative += negative_values.values
439
421
 
440
- elif style == 'line':
422
+ elif mode == 'line':
441
423
  for i, column in enumerate(data.columns):
442
424
  ax.step(data.index, data[column], where='post', color=processed_colors[i], label=column)
443
425