Skip to content

Commit

Permalink
Merge pull request #135 from slacgismo/main
Browse files Browse the repository at this point in the history
Merge time shift bug correction
  • Loading branch information
pluflou authored Mar 29, 2024
2 parents ffe2980 + abc0dba commit 850519a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 28 deletions.
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,29 @@ bh_unicode_properties.cache
GitHub.sublime-settings

# End of https://www.gitignore.io/api/data,macos,python,pycharm,database,sublimetext,jupyternotebook

# Created by https://www.toptal.com/developers/gitignore/api/vim
# Edit at https://www.toptal.com/developers/gitignore?templates=vim

### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

# End of https://www.toptal.com/developers/gitignore/api/vim
34 changes: 13 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,16 @@ See [notebooks](/notebooks) folder for examples.

### 3 ways of setting up, either approach works:

#### 1) Recommended: Set up `conda` environment with provided `.yml` file
#### 1) Recommended: Install with pip

We recommend setting up a fresh Python virtual environment in which to use `solar-data-tools`. We recommend using the [Conda](https://docs.conda.io/projects/conda/en/latest/index.html) package management system, and creating an environment with the environment configuration file named `pvi-user.yml`, provided in the top level of this repository. This will install the `statistical-clear-sky` package as well.
In a fresh Python virtual environment, simply run


```bash
$ pip install solar-data-tools
```

#### 2) Creat conda virtual environment from file

Creating the env:

Expand Down Expand Up @@ -123,32 +130,17 @@ $ conda env update -f pvi-user.yml

Additional documentation on setting up the Conda environment is available [here](https://github.com/slacgismo/pvinsight-onboarding/blob/main/README.md).


#### 2) PIP Package

```sh
$ pip install solar-data-tools
```

Alternative: Clone repo from GitHub

Mimic the pip package by setting up locally.

```bash
$ pip install -e path/to/root/folder
```

#### 3) Anaconda Package
#### 3) General Anaconda Package

```sh
$ conda install -c slacgismo solar-data-tools
$ conda install slacgismo::solar-data-tools
```

### Solvers

#### QSS & OSQP
#### QSS & CLARABEL

By default, [QSS](https://github.com/cvxgrp/qss) and OSQP solvers are used for non-convex and convex problems, respectively. Both are supported by [OSD](https://github.com/cvxgrp/signal-decomposition/tree/main), the modeling language used to solve signal decomposition problems in Solar Data Tools, and both are open source.
By default, [QSS](https://github.com/cvxgrp/qss) and CLARABEL solvers are used for non-convex and convex problems, respectively. Both are supported by [OSD](https://github.com/cvxgrp/signal-decomposition/tree/main), the modeling language used to solve signal decomposition problems in Solar Data Tools, and both are open source.

#### MOSEK

Expand Down
5 changes: 0 additions & 5 deletions solardatatools/data_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,11 +1141,6 @@ def rescale_signal(signal, minimum, maximum):
use_ixs = self.daily_flags.clear
else:
use_ixs = self.daily_flags.no_errors
### NEW 3/20/24: overwrite use of qss on this function. Forcing CLARABEL here uses the old-style
# iteratively reweighted model, rather than the nonconvex piecewise constant model. In testing,
# the older model (which is not technically covered by the monograph) seems to work better.
if solver != "MOSEK":
solver = "CLARABEL"
########## Updates to timeshift algorithm, 6/2023 ##########
# If running with any solver other than QSS: solve convex problem
# If running with QSS without a set w1: run w1 meta-opt with convex problem,
Expand Down
8 changes: 6 additions & 2 deletions solardatatools/signal_decompositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def l2_l1d1_l2d2p365(
yearly_periodic=yearly_periodic,
return_all=return_all,
transition_locs=transition_locs,
solver=solver,
verbose=verbose,
)
elif yearly_periodic:
Expand Down Expand Up @@ -172,6 +173,7 @@ def tl1_l2d2p365(
w1=w1,
yearly_periodic=yearly_periodic,
return_all=return_all,
solver=solver,
verbose=verbose,
)
else:
Expand Down Expand Up @@ -226,7 +228,8 @@ def l1_l1d1_l2d2p365(
if solver == "MOSEK":
# MOSEK weights set in CVXPY function
res = _cvx_l1_l1d1_l2d2p365(
signal=signal, use_ixs=use_ixs, return_all=return_all, verbose=verbose
signal=signal, use_ixs=use_ixs, return_all=return_all,
solver=solver, verbose=verbose
)
else:
res = _osd_l1_l1d1_l2d2p365(
Expand Down Expand Up @@ -264,7 +267,8 @@ def l2_l1d2_constrained(
"""
if solver == "MOSEK":
# MOSEK weights set in CVXPY function
res = _cvx_l2_l1d2_constrained(signal, return_all=return_all, verbose=verbose)
res = _cvx_l2_l1d2_constrained(signal, return_all=return_all,
solver=solver, verbose=verbose)
else:
res = _osd_l2_l1d2_constrained(
signal, w0=w0, w1=w1, return_all=return_all, solver=solver, verbose=verbose
Expand Down

0 comments on commit 850519a

Please sign in to comment.