Skip to content

Commit

Permalink
Revert update to new import. Will show warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
viljarjf committed Nov 7, 2024
1 parent fa52acc commit 3f68f1e
Show file tree
Hide file tree
Showing 22 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/instamatic/calibrate/calibrate_beamshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ def main_entry():
args = options.args

if not args:
from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize()
ctrl = TEMController.initialize()
calibrate_beamshift(ctrl=ctrl, save_images=True)
else:
center_fn = args[0]
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/calibrate/calibrate_brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def main_entry():
args = options.args

if not args:
from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize()
ctrl = TEMController.initialize()
calibrate_brightness(ctrl, save_images=True)
else:
calibrate_brightness(args)
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/calibrate/calibrate_directbeam.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ def main_entry():
if args:
calibrate_directbeam(patterns=args)
else:
from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize()
ctrl = TEMController.initialize()
calibrate_directbeam(ctrl=ctrl)


Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/calibrate/calibrate_stage_lowmag.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ def main_entry():
args = options.args

if not args:
from instamatic import controller
from instamatic import TEMController

ctrl = TEMtroller.initialize()
ctrl = TEMController.initialize()
calibrate_stage_lowmag(ctrl=ctrl, save_images=True)
else:
center_fn = args[0]
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/calibrate/calibrate_stage_mag1.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ def main_entry():
args = options.args

if not args:
from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize()
ctrl = TEMController.initialize()
calibrate_mag1(ctrl=ctrl, save_images=True)
else:
center_fn = args[0]
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/calibrate/calibrate_stagematrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ def main_entry():
mode = options.mode
mags = options.mags

from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize()
ctrl = TEMController.initialize()

if not mode:
mode = ctrl.mode.get()
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/camera/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ def main_entry():

take_series = options.take_series

from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize()
ctrl = TEMController.initialize()

if take_series:
i = 1
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/experiments/cred_gatan/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,14 @@ def log_stage_positions(self):


if __name__ == '__main__':
from instamatic import controller
from instamatic import TEMController
from instamatic.io import get_new_work_subdirectory

print('Usage:')
print(' 1. Start `insteadmatic_module.s` in DM')
print(' 2. Run this script.')

ctrl = controller.initialize()
ctrl = TEMController.initialize()

time.sleep(1)

Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/experiments/cred_tvips/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,10 @@ def log_stage_positions(self):


if __name__ == '__main__':
from instamatic import controller
from instamatic import TEMController
from instamatic.io import get_new_work_subdirectory

ctrl = controller.initialize()
ctrl = TEMController.initialize()

expdir = get_new_work_subdirectory()
expdir.mkdir(exist_ok=True, parents=True)
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/experiments/red/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ def teardown(self):


def main():
from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize()
ctrl = TEMController.initialize()

import logging

Expand Down
2 changes: 1 addition & 1 deletion src/instamatic/experiments/serialed/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def main():

options = parser.parse_args()

from instamatic import microscope
from instamatic import TEMController

try:
params = json.load(open('params.json'))
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/gridmontage.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ def plot(self):


if __name__ == '__main__':
from instamatic import TEMtroller
from instamatic import TEMController

ctrl = TEMtroller.initialize()
ctrl = TEMController.initialize()
ctrl.mode.set('lowmag')
ctrl.magnification.value = 100

Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/gui/cred_tvips_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ def __init__(self, parent):

frame.pack(side='bottom', fill='x', padx=10, pady=10)

from instamatic import controller
from instamatic import TEMController

self.ctrl = controller.get_instance()
self.ctrl = TEMController.get_instance()

def init_vars(self):
self.var_target_angle = DoubleVar(value=40.0)
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/gui/ctrl_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ def __init__(self, parent):

frame.pack(side='top', fill='x', padx=10, pady=10)

from instamatic import controller
from instamatic import TEMController

self.ctrl = controller.get_instance()
self.ctrl = TEMController.get_instance()

def init_vars(self):
self.var_negative_angle = DoubleVar(value=-40)
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/gui/defocus_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from tkinter import *
from tkinter.ttk import *

from instamatic import controller
from instamatic import TEMController


class DefocusButton(LabelFrame):
Expand Down Expand Up @@ -84,7 +84,7 @@ def main():

options = parser.parse_args()

ctrl = controller.initialize()
ctrl = TEMController.initialize()

root = Tk()
DefocusButton(root).pack(side='top', fill='both', expand=True, padx=10, pady=10)
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def start_gui(ctrl, log=None):


if __name__ == '__main__':
from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize()
ctrl = TEMController.initialize()
start_gui(ctrl)
4 changes: 2 additions & 2 deletions src/instamatic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ def main():
log = logging.getLogger(__name__)
log.info(f'Instamatic started: {repr(options.__dict__)}')

from instamatic import controller
from instamatic import TEMController

ctrl = controller.initialize(stream=True)
ctrl = TEMController.initialize(stream=True)

if options.nav_file:
from pyserialem import read_nav_file
Expand Down
2 changes: 1 addition & 1 deletion src/instamatic/microscope/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _eval_dct(self, dct):
raise ConnectionError(f'Unknown status code: {status}')

def _init_dict(self):
from instamatic.microscope.microscope import get_microscope_class
from instamatic.microscope import get_microscope_class

tem = get_microscope_class(interface=self.interface)

Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/processing/flatfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np
from tqdm.auto import tqdm

from instamatic import config, controller
from instamatic import TEMController, config
from instamatic.formats import *


Expand Down Expand Up @@ -234,7 +234,7 @@ def main_entry():
args = options.args

if options.collect:
ctrl = controller.initialize()
ctrl = TEMController.initialize()
collect_flatfield(ctrl=ctrl, save_images=False)
ctrl.close()
exit()
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/server/TEMServer_FEI.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import threading
from socket import *

from instamatic import TEMtroller, config
from instamatic import TEMController, config

HOST = config.settings.fei_server_host
PORT = config.settings.fei_server_port
Expand Down Expand Up @@ -68,7 +68,7 @@ def main():
logging.captureWarnings(True)
log = logging.getLogger(__name__)

ctrl = TEMtroller.initialize()
ctrl = TEMController.initialize()

s = socket(AF_INET, SOCK_STREAM)
s.bind((HOST, PORT))
Expand Down
4 changes: 2 additions & 2 deletions src/instamatic/server/tem_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import traceback

from instamatic import config
from instamatic.microscope import get_microscope
from instamatic.TEMController import Microscope

from .serializer import dumper, loader

Expand Down Expand Up @@ -45,7 +45,7 @@ def __init__(self, log=None, q=None, name=None):

def run(self):
"""Start the server thread."""
self.tem = get_microscope(name=self._name, use_server=False)
self.tem = Microscope(name=self._name, use_server=False)
print(f'Initialized connection to microscope: {self.tem.name}')

while True:
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def pytest_configure():

@pytest.fixture(scope='module')
def ctrl() -> 'TEMController':
from instamatic.controller import initialize
from instamatic import controller

ctrl = initialize()
ctrl = controller.initialize()

# set instant stage movement for testing
ctrl.tem._set_instant_stage_movement()
Expand Down

0 comments on commit 3f68f1e

Please sign in to comment.