Skip to content

Develop code review#1

Open
nocliper wants to merge 4 commits intomasterfrom
develop
Open

Develop code review#1
nocliper wants to merge 4 commits intomasterfrom
develop

Conversation

@nocliper
Copy link
Copy Markdown
Owner

@nocliper nocliper commented Nov 2, 2023

No description provided.

@nocliper nocliper added the good first issue Good for newcomers label Nov 2, 2023
@nocliper nocliper requested a review from kafanovd November 2, 2023 13:14
Comment thread modules/L1L2.py

import numpy as np
from scipy.sparse import diags
from sklearn.linear_model import ElasticNet
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

импорты в начало

Comment thread modules/L1L2.py
from sklearn.linear_model import ElasticNet

# set up grid points (# = Nz)
h = np.log(bound[1]/bound[0])/(Nz - 1) # equally spaced on logscale
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробелы

Comment thread modules/L1L2.py

# construct C matrix from [1]
s_mesh, t_mesh = np.meshgrid(s, t)
C = np.exp(-t_mesh*s_mesh)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробелы

Comment thread modules/L1L2.py
C *= h

alpha = alpha1 + alpha2
l1_ratio = alpha1/alpha
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробелы

Comment thread modules/L1L2.py

# set up grid points (# = Nz)
h = np.log(bound[1]/bound[0])/(Nz - 1) # equally spaced on logscale
s = bound[0]*np.exp(np.arange(Nz)*h) # z (Nz by 1)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно переменные обозвать терминами, чтобы более читабельно было

Comment thread modules/contin.py
Solution of argmin_x || Ax - b ||_2
"""

from scipy.optimize import nnls
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

импорт в начало

Comment thread modules/contin.py
C = np.exp(-t_mesh*z_mesh)
C[:, 0] /= 2.
C[:, -1] /= 2.
C *= h
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

```
h = np.log(bound[1]/bound[0])/(Nz - 1)      # equally spaced on logscale
z = bound[0]*np.exp(np.arange(Nz)*h)        # z (Nz by 1)

z_mesh, t_mesh = np.meshgrid(z, t)
C = np.exp(-t_mesh*z_mesh)       
C[:, 0] /= 2.
C[:, -1] /= 2.
C *= h```

У тебя этот кусок используется много раз. Можно написать метод отдельный для него, чтобы не дублировать код

Comment thread modules/demo.py
from hp import hp
from read_file import read_file
from regopt import regopt
from interface import interface
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в начало

Comment thread modules/demo.py

Bounds = 10.0**np.asarray(Bounds)

t, C, T = read_file(interface.path, dt, proc = True)# time, transients, temperatures
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

коммент и пробелы убрать для proc

Comment thread modules/filebrowser.py
self.path = os.getcwd()
self._update_files()

def _update_files(self):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

здесь тоже для всех методов типы и анотации

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants