Skip to content

Commit

Permalink
added feature to remove transitions related to removed level.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaadt7 committed Oct 12, 2023
1 parent edff2de commit a14964f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
8 changes: 8 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Changelog
All notable changes to this project will be documented in this file. This
project adheres to `Semantic Versioning <http://semver.org/spec/v2.0.0.html>`_.

Version 3.0.3
-------------

Fix:

* Removing a level now removes all transitions to and from the level before removing
the level itself. This alleviates any issues that arise after removing the level.

Version 3.0.2
-------------

Expand Down
2 changes: 1 addition & 1 deletion lvlspy/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@

__title__ = "lvlspy"
__summary__ = "Python project to work with quantum level system data"
__version__ = "3.0.2"
__version__ = "3.0.3"
__author__ = "Clemson University"
__copyright__ = "Clemson University, 2022-2023"
16 changes: 15 additions & 1 deletion lvlspy/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,23 @@ def remove_level(self, level):
``level`` (:obj:`lvlspy.level.Level`) The level to be removed.
Return:
On successful return, the level has been removed.
On successful return, the level and all connected transitions have been removed.
"""
upper_conn = self.get_upper_linked_levels(level)
lower_conn = self.get_lower_linked_levels(level)

for l in upper_conn:
t = self.get_level_to_level_transition(l,level)
if t is None:
continue
self.remove_transition(t)

for l in lower_conn:
t = self.get_level_to_level_transition(level,l)
if t is None:
continue
self.remove_transition(t)

self.levels.remove(level)

Expand Down

0 comments on commit a14964f

Please sign in to comment.