mirror of
https://github.com/fjosw/pyerrors.git
synced 2026-08-04 19:41:17 +02:00
[Feat] More specific Exception statements (#287)
* [Feat] More specific Exception statements * [Fix] Address copilot comments
This commit is contained in:
parent
e72949b69b
commit
470e2c57fc
14 changed files with 73 additions and 73 deletions
|
|
@ -35,7 +35,7 @@ def matrix_pencil_method(corrs, k=1, p=None, **kwargs):
|
|||
|
||||
lengths = [len(d) for d in data]
|
||||
if lengths.count(lengths[0]) != len(lengths):
|
||||
raise Exception('All datasets have to have the same length.')
|
||||
raise ValueError('All datasets have to have the same length.')
|
||||
|
||||
data_sets = len(data)
|
||||
n_data = len(data[0])
|
||||
|
|
@ -43,9 +43,9 @@ def matrix_pencil_method(corrs, k=1, p=None, **kwargs):
|
|||
if p is None:
|
||||
p = max(n_data // 2, k)
|
||||
if n_data <= p:
|
||||
raise Exception('The pencil p has to be smaller than the number of data samples.')
|
||||
raise ValueError('The pencil p has to be smaller than the number of data samples.')
|
||||
if p < k or n_data - p < k:
|
||||
raise Exception('Cannot extract', k, 'energy levels with p=', p, 'and N-p=', n_data - p)
|
||||
raise ValueError(f'Cannot extract {k} energy levels with p={p} and N-p={n_data - p}')
|
||||
|
||||
# Construct the hankel matrices
|
||||
matrix = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue