-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes _index from cocos params, improves & fixes docs, raises when …
…cannot det. single cocos or no qpsi present (#18) * docs and removal of _index and change to the way identify works, it raises if it cannot find a single convention and qpsi must be provided * improved error message for improper id'ing * improved error messages, fixed tests, added negative qpsi for all bluemira generated eqdsks
- Loading branch information
1 parent
4176b3f
commit 19b457e
Showing
5 changed files
with
231 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-FileCopyrightText: 2023-present The Bluemira Developers <https://github.com/Fusion-Power-Plant-Framework/bluemira> | ||
# | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
"""Custom errors""" | ||
|
||
from eqdsk.cocos import COCOS | ||
|
||
|
||
class NoSingleConventionError(Exception): | ||
"""Raised when no single COCOS can be determined from the EQDSK file.""" | ||
|
||
def __init__(self, conventions: list[COCOS], message_extra: str): | ||
self.conventions = conventions | ||
self.message_extra = message_extra | ||
super().__init__( | ||
f"A single COCOS could not be determined, " | ||
f"found conventions " | ||
f"({', '.join([str(c.index) for c in self.conventions])}) " | ||
f"for the EQDSK file.\n{self.message_extra}" | ||
) | ||
|
||
|
||
class MissingQpsiDataError(Exception): | ||
"""Raised when attempting to identify the COCOS for an EQDSK file, | ||
that does not have an qpsi data in it. | ||
""" | ||
|
||
def __init__(self, message_extra: str): | ||
self.message_extra = message_extra | ||
super().__init__( | ||
f"In order to properly identify the COCOS of this EQDSK file, " | ||
f"qpsi data must be present in the file.\n{self.message_extra}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.