MarcSerraPeralta / surface-sim

Repository for simulations of surface code experiments
MIT License
0 stars 1 forks source link

Change `surface_code_...` modules to `rotated_surface_code_...` #89

Closed MarcSerraPeralta closed 6 days ago

MarcSerraPeralta commented 1 week ago

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

MarcSerraPeralta commented 1 week ago

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"]
MarcSerraPeralta commented 6 days ago

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.