From 072923fb86e611399a3efad8c26307168f15cf9a Mon Sep 17 00:00:00 2001 From: Russel Torres Date: Wed, 27 Mar 2024 01:13:09 -0700 Subject: [PATCH] imports: format import order --- .../lens_correction/lens_correction_solver.py | 26 +++++++++++-------- .../mesh_and_solve_transform.py | 24 ++++++++++------- em_stitch/lens_correction/schemas.py | 7 +++-- em_stitch/lens_correction/utils.py | 12 +++++---- em_stitch/montage/meta_to_collection.py | 2 +- em_stitch/montage/montage_solver.py | 16 +++++++----- em_stitch/montage/schemas.py | 8 ++++-- em_stitch/plots/lens_quiver_plots.py | 20 ++++++++------ em_stitch/plots/montage_plots.py | 11 +++++--- em_stitch/plots/schemas.py | 4 +-- em_stitch/plots/view_matches.py | 15 ++++++----- .../generate_EM_tilespecs_from_metafile.py | 11 +++++--- em_stitch/utils/schemas.py | 7 +++-- em_stitch/utils/utils.py | 6 +++-- em_stitch/viz/schemas.py | 5 +++- em_stitch/viz/set_permissions.py | 11 +++++--- em_stitch/viz/set_update_upload.py | 6 +++-- em_stitch/viz/update_urls.py | 11 +++++--- em_stitch/viz/upload_to_render.py | 8 +++--- 19 files changed, 130 insertions(+), 80 deletions(-) diff --git a/em_stitch/lens_correction/lens_correction_solver.py b/em_stitch/lens_correction/lens_correction_solver.py index 203f3ee..1b33a9e 100644 --- a/em_stitch/lens_correction/lens_correction_solver.py +++ b/em_stitch/lens_correction/lens_correction_solver.py @@ -1,19 +1,23 @@ +import glob +import json +import logging +import os +import warnings + +import cv2 +import numpy as np + from argschema import ArgSchemaParser +from bigfeta import jsongz +import renderapi + from .schemas import LensCorrectionSchema -from ..utils.generate_EM_tilespecs_from_metafile import \ - GenerateEMTileSpecsModule +from ..utils.generate_EM_tilespecs_from_metafile import ( + GenerateEMTileSpecsModule) from ..utils import utils as common_utils from .mesh_and_solve_transform import MeshAndSolveTransform from . import utils -from bigfeta import jsongz -import logging -import os -import glob -import json -import numpy as np -import renderapi -import cv2 -import warnings + warnings.simplefilter(action='ignore', category=FutureWarning) logger = logging.getLogger(__name__) diff --git a/em_stitch/lens_correction/mesh_and_solve_transform.py b/em_stitch/lens_correction/mesh_and_solve_transform.py index 2312f08..916e1fa 100644 --- a/em_stitch/lens_correction/mesh_and_solve_transform.py +++ b/em_stitch/lens_correction/mesh_and_solve_transform.py @@ -1,21 +1,25 @@ +import copy +import datetime +import logging +import os + +from six.moves import urllib + +import cv2 import numpy as np -import triangle import scipy.optimize -from scipy.spatial import Delaunay import scipy.sparse as sparse from scipy.sparse import csr_matrix from scipy.sparse.linalg import factorized -import renderapi -import copy -import os -import datetime -import cv2 -from six.moves import urllib +from scipy.spatial import Delaunay +import triangle + from argschema import ArgSchemaParser +from bigfeta import jsongz +import renderapi + from .schemas import MeshLensCorrectionSchema from .utils import remove_weighted_matches -from bigfeta import jsongz -import logging try: # pandas unique is faster than numpy, use where appropriate diff --git a/em_stitch/lens_correction/schemas.py b/em_stitch/lens_correction/schemas.py index 6a9458d..385e30c 100644 --- a/em_stitch/lens_correction/schemas.py +++ b/em_stitch/lens_correction/schemas.py @@ -1,11 +1,14 @@ import warnings + from marshmallow.warnings import ChangedInMarshmallow3Warning import marshmallow as mm + from argschema import ArgSchema from argschema.schemas import DefaultSchema from argschema.fields import ( - Boolean, InputDir, InputFile, Float, List, - Int, OutputDir, Nested, Str, Dict) + Boolean, InputDir, InputFile, Float, List, + Int, OutputDir, Nested, Str, Dict) + warnings.simplefilter( action='ignore', category=ChangedInMarshmallow3Warning) diff --git a/em_stitch/lens_correction/utils.py b/em_stitch/lens_correction/utils.py index a0ad108..1a7fd48 100644 --- a/em_stitch/lens_correction/utils.py +++ b/em_stitch/lens_correction/utils.py @@ -1,11 +1,13 @@ -import numpy as np -import cv2 -import renderapi import time -from scipy import ndimage import logging -from ..utils import utils as common_utils +import cv2 +import numpy as np +from scipy import ndimage + +import renderapi + +from ..utils import utils as common_utils logger = logging.getLogger(__name__) diff --git a/em_stitch/montage/meta_to_collection.py b/em_stitch/montage/meta_to_collection.py index 872c5fd..4011747 100644 --- a/em_stitch/montage/meta_to_collection.py +++ b/em_stitch/montage/meta_to_collection.py @@ -5,11 +5,11 @@ ''' import argparse +from enum import IntEnum import glob import json import os import sys -from enum import IntEnum # Position codes in metafile diff --git a/em_stitch/montage/montage_solver.py b/em_stitch/montage/montage_solver.py index d81a531..3620ddc 100644 --- a/em_stitch/montage/montage_solver.py +++ b/em_stitch/montage/montage_solver.py @@ -1,15 +1,17 @@ +import glob +import json +import os + from argschema import ArgSchemaParser +from bigfeta import jsongz +import bigfeta.bigfeta as bfa import renderapi + from em_stitch.montage import meta_to_collection from em_stitch.montage.schemas import MontageSolverSchema -from em_stitch.utils.generate_EM_tilespecs_from_metafile import \ - GenerateEMTileSpecsModule +from em_stitch.utils.generate_EM_tilespecs_from_metafile import ( + GenerateEMTileSpecsModule) from em_stitch.utils.utils import pointmatch_filter, get_z_from_metafile -from bigfeta import jsongz -import bigfeta.bigfeta as bfa -import json -import os -import glob dname = os.path.join( os.path.dirname(os.path.abspath(__file__)), diff --git a/em_stitch/montage/schemas.py b/em_stitch/montage/schemas.py index 088a456..f22679d 100644 --- a/em_stitch/montage/schemas.py +++ b/em_stitch/montage/schemas.py @@ -1,10 +1,14 @@ +import os import warnings + from marshmallow.warnings import ChangedInMarshmallow3Warning import marshmallow as mm + from argschema import ArgSchema from argschema.fields import ( - Boolean, InputDir, InputFile, Float, OutputDir, List, Str, Dict) -import os + Boolean, InputDir, InputFile, Float, + OutputDir, List, Str, Dict) + warnings.simplefilter( action='ignore', category=ChangedInMarshmallow3Warning) diff --git a/em_stitch/plots/lens_quiver_plots.py b/em_stitch/plots/lens_quiver_plots.py index 94ff938..90a0cba 100644 --- a/em_stitch/plots/lens_quiver_plots.py +++ b/em_stitch/plots/lens_quiver_plots.py @@ -1,17 +1,21 @@ -import renderapi -from matplotlib.backends.backend_pdf import PdfPages -import matplotlib.pyplot as plt -import json -import numpy as np +import datetime import glob +import json import os import re import warnings -import datetime -from em_stitch.utils.utils import src_from_xy -from em_stitch.plots.schemas import LensQuiverSchema + +from matplotlib.backends.backend_pdf import PdfPages +import matplotlib.pyplot as plt +import numpy as np + from argschema import ArgSchemaParser from bigfeta import jsongz +import renderapi + +from em_stitch.utils.utils import src_from_xy +from em_stitch.plots.schemas import LensQuiverSchema + warnings.simplefilter(action='ignore', category=FutureWarning) example = { diff --git a/em_stitch/plots/montage_plots.py b/em_stitch/plots/montage_plots.py index e458357..444f8dc 100644 --- a/em_stitch/plots/montage_plots.py +++ b/em_stitch/plots/montage_plots.py @@ -1,13 +1,16 @@ +import json +import os + from matplotlib.backends.backend_pdf import PdfPages -from argschema import ArgSchemaParser import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable -import renderapi import numpy as np -import json + +from argschema import ArgSchemaParser from bigfeta import jsongz +import renderapi + from em_stitch.plots.schemas import MontagePlotsSchema -import os example = { "collection_path": "/data/em-131fs3/lctest/T4.2019.04.29b/001738/0/collection.json.gz", diff --git a/em_stitch/plots/schemas.py b/em_stitch/plots/schemas.py index 2a24f71..3141b7f 100644 --- a/em_stitch/plots/schemas.py +++ b/em_stitch/plots/schemas.py @@ -1,7 +1,7 @@ from argschema import ArgSchema from argschema.fields import ( - InputDir, InputFile, Str, List, Boolean, Int, - OutputFile, Float) + InputDir, InputFile, Str, List, Boolean, Int, + OutputFile, Float) class LensQuiverSchema(ArgSchema): diff --git a/em_stitch/plots/view_matches.py b/em_stitch/plots/view_matches.py index e67b72e..f8b6050 100644 --- a/em_stitch/plots/view_matches.py +++ b/em_stitch/plots/view_matches.py @@ -1,14 +1,17 @@ -from matplotlib.backends.backend_pdf import PdfPages -import matplotlib.pyplot as plt +import logging import os + +import cv2 import numpy as np -import logging -from em_stitch.lens_correction.utils import maps_from_tform +from matplotlib.backends.backend_pdf import PdfPages +import matplotlib.pyplot as plt + +from argschema import ArgSchemaParser from bigfeta import jsongz import renderapi -import cv2 + from em_stitch.plots.schemas import ViewMatchesSchema -from argschema import ArgSchemaParser +from em_stitch.lens_correction.utils import maps_from_tform logger = logging.getLogger() diff --git a/em_stitch/utils/generate_EM_tilespecs_from_metafile.py b/em_stitch/utils/generate_EM_tilespecs_from_metafile.py index 2706985..9db8392 100644 --- a/em_stitch/utils/generate_EM_tilespecs_from_metafile.py +++ b/em_stitch/utils/generate_EM_tilespecs_from_metafile.py @@ -1,10 +1,13 @@ -import renderapi -import os import json -import numpy +import os import pathlib -from bigfeta import jsongz + +import numpy + from argschema import ArgSchemaParser +from bigfeta import jsongz +import renderapi + from .schemas import GenerateEMTileSpecsParameters # this is a modification of https://github.com/AllenInstitute/ diff --git a/em_stitch/utils/schemas.py b/em_stitch/utils/schemas.py index d06fd2b..a066c27 100644 --- a/em_stitch/utils/schemas.py +++ b/em_stitch/utils/schemas.py @@ -1,9 +1,12 @@ import warnings + from marshmallow.warnings import ChangedInMarshmallow3Warning + from argschema import ArgSchema from argschema.fields import ( - InputDir, InputFile, Float, - Int, OutputFile, Str, Boolean) + InputDir, InputFile, Float, + Int, OutputFile, Str, Boolean) + warnings.simplefilter( action='ignore', category=ChangedInMarshmallow3Warning) diff --git a/em_stitch/utils/utils.py b/em_stitch/utils/utils.py index 739e737..37b8ede 100644 --- a/em_stitch/utils/utils.py +++ b/em_stitch/utils/utils.py @@ -1,6 +1,8 @@ -import numpy as np -import cv2 import json + +import cv2 +import numpy as np + import renderapi diff --git a/em_stitch/viz/schemas.py b/em_stitch/viz/schemas.py index 6f6305d..04c24ae 100644 --- a/em_stitch/viz/schemas.py +++ b/em_stitch/viz/schemas.py @@ -1,9 +1,12 @@ import warnings + from marshmallow.warnings import ChangedInMarshmallow3Warning + from argschema import ArgSchema from argschema.schemas import DefaultSchema from argschema.fields import ( - Nested, Int, Str, Boolean, List) + Nested, Int, Str, Boolean, List) + warnings.simplefilter( action='ignore', category=ChangedInMarshmallow3Warning) diff --git a/em_stitch/viz/set_permissions.py b/em_stitch/viz/set_permissions.py index ef07770..47d531d 100644 --- a/em_stitch/viz/set_permissions.py +++ b/em_stitch/viz/set_permissions.py @@ -1,9 +1,12 @@ -from argschema import ArgSchemaParser -from .schemas import SetPermissionsSchema +import logging +import os + import subprocess import sys -import os -import logging + +from argschema import ArgSchemaParser + +from .schemas import SetPermissionsSchema logger = logging.getLogger(__name__) diff --git a/em_stitch/viz/set_update_upload.py b/em_stitch/viz/set_update_upload.py index c824050..9c190d8 100644 --- a/em_stitch/viz/set_update_upload.py +++ b/em_stitch/viz/set_update_upload.py @@ -1,10 +1,12 @@ +import logging +import os + from argschema import ArgSchemaParser + from em_stitch.viz.schemas import SetUpdateUploadSchema from em_stitch.viz.set_permissions import SetPermissions from em_stitch.viz.update_urls import UpdateUrls from em_stitch.viz.upload_to_render import UploadToRender -import os -import logging logger = logging.getLogger(__name__) diff --git a/em_stitch/viz/update_urls.py b/em_stitch/viz/update_urls.py index df80ec6..147d23d 100644 --- a/em_stitch/viz/update_urls.py +++ b/em_stitch/viz/update_urls.py @@ -1,12 +1,15 @@ +import logging import os +import pathlib import shutil + from six.moves import urllib -import pathlib -from bigfeta import jsongz + from argschema import ArgSchemaParser -from .schemas import UpdateUrlSchema +from bigfeta import jsongz import renderapi -import logging + +from .schemas import UpdateUrlSchema logger = logging.getLogger(__name__) diff --git a/em_stitch/viz/upload_to_render.py b/em_stitch/viz/upload_to_render.py index ddedfae..ded702e 100644 --- a/em_stitch/viz/upload_to_render.py +++ b/em_stitch/viz/upload_to_render.py @@ -1,9 +1,11 @@ +import logging +import os + from argschema import ArgSchemaParser +from bigfeta import jsongz import renderapi + from .schemas import UploadToRenderSchema -from bigfeta import jsongz -import os -import logging logger = logging.getLogger(__name__)