MarcSerraPeralta/surface-sim

Change `surface_code_...` modules to `rotated_surface_code_...`

Closed this issue · 2 comments

Improve naming scheme.
Also, this is good if in the future I add the unrotated surface codes.

I should add a deprecation warning and keep the option to use surface_code_....
This could be achieved with:

# __init__.py
from . import rotated_surface_code
from warnings import warn

def __getattr__(name):
    if name == "surface_code":
        warn("'surface_code' has been renamed to 'rotated_surface_code'")
        return rotated_surface_code
    raise AttributeError('No module named ' + name)

__all__ = ["rotated_surface_code"]
from . import rotated_surface_code
from warnings import warn

def __getattr__(name):
    if name == "surface_code":
        warn("'surface_code' has been renamed to 'rotated_surface_code'")
        return rotated_surface_code
    raise AttributeError('No module named ' + name)

__all__ = ["rotated_surface_code"]```

does not work when doing from surface_sim.experiments.surface_code_css import *. It tells that the module does not exist.

I have copied the files and renamed them rot_surface_code_.... It is not a very nice solution, but this they can be removed in the next version.