Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Unused Imports #698

Merged
merged 4 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ark/analysis/dimensionality_reduction.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
import seaborn as sns
import umap
import os
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from sklearn.preprocessing import StandardScaler

from ark.utils import misc_utils

Expand Down
5 changes: 3 additions & 2 deletions ark/analysis/dimensionality_reduction_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import tempfile
import os
import tempfile

import pytest

import ark.settings as settings
from ark.analysis import dimensionality_reduction
from ark.utils import test_utils
import ark.settings as settings


def test_plot_dim_reduced_data():
Expand Down
7 changes: 4 additions & 3 deletions ark/analysis/spatial_analysis.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from itertools import combinations_with_replacement

import numpy as np
import pandas as pd
import xarray as xr
import numpy as np
from tqdm.auto import tqdm
from itertools import combinations_with_replacement
from ark.utils import spatial_analysis_utils, misc_utils, load_utils, io_utils

import ark.settings as settings
from ark.utils import io_utils, load_utils, misc_utils, spatial_analysis_utils


def batch_channel_spatial_enrichment(label_dir, marker_thresholds, all_data, batch_size=5,
Expand Down
8 changes: 4 additions & 4 deletions ark/analysis/spatial_analysis_test.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import tempfile
import pytest

import numpy as np
import pandas as pd

from ark.analysis import spatial_analysis
import pytest

import ark.settings as settings
from ark.utils import spatial_analysis_utils, load_utils, test_utils
from ark.analysis import spatial_analysis
from ark.utils import load_utils, spatial_analysis_utils, test_utils

EXCLUDE_CHANNELS = [
"Background",
Expand Down
13 changes: 0 additions & 13 deletions ark/phenotyping/cell_cluster_utils.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
from functools import partial
import multiprocessing
import os
import json
import subprocess
import warnings

import feather
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pyarrow.lib import ArrowInvalid
import re
import scipy.ndimage as ndimage
import scipy.stats as stats
from shutil import rmtree
from skimage.io import imread, imsave
import xarray as xr

from ark.analysis import visualize
import ark.settings as settings
from ark.utils import io_utils
from ark.utils import load_utils
from ark.utils import misc_utils


Expand Down
15 changes: 1 addition & 14 deletions ark/phenotyping/cell_cluster_utils_test.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
import json
import os
import pytest
from pytest_cases import parametrize_with_cases
from shutil import rmtree
import tempfile
import textwrap
import warnings

import feather
from matplotlib.colors import ListedColormap
import numpy as np
import pandas as pd
from skimage.draw import disk
import skimage.io as io
import scipy.ndimage as ndimage
import pytest
from sklearn.utils import shuffle
import xarray as xr

import ark.phenotyping.cell_cluster_utils as cell_cluster_utils
import ark.utils.io_utils as io_utils
import ark.utils.load_utils as load_utils
import ark.utils.misc_utils as misc_utils
import ark.utils.test_utils as test_utils

parametrize = pytest.mark.parametrize

Expand Down
18 changes: 4 additions & 14 deletions ark/phenotyping/pixel_cluster_utils.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
from functools import partial
import multiprocessing
import os
import json
import subprocess
import warnings
from functools import partial
from shutil import rmtree

import feather
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pyarrow.lib import ArrowInvalid
import re
import scipy.ndimage as ndimage
import scipy.stats as stats
from shutil import rmtree
from pyarrow.lib import ArrowInvalid
from skimage.io import imread, imsave
import xarray as xr

from ark.analysis import visualize
import ark.settings as settings
from ark.utils import io_utils
from ark.utils import load_utils
from ark.utils import misc_utils
from ark.utils import io_utils, load_utils, misc_utils

multiprocessing.set_start_method('spawn', force=True)

Expand Down
16 changes: 5 additions & 11 deletions ark/phenotyping/pixel_cluster_utils_test.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import json
import os
import pytest
from pytest_cases import parametrize_with_cases
from shutil import rmtree
import tempfile
import textwrap
import warnings
from shutil import rmtree

import feather
from matplotlib.colors import ListedColormap
import numpy as np
import pandas as pd
from skimage.draw import disk
import skimage.io as io
import pytest
import scipy.ndimage as ndimage
from sklearn.utils import shuffle
import xarray as xr
import skimage.io as io
from pytest_cases import parametrize_with_cases
from skimage.draw import disk

import ark.phenotyping.pixel_cluster_utils as pixel_cluster_utils
from ark.phenotyping.pixel_cluster_utils import create_fov_pixel_data
import ark.utils.io_utils as io_utils
import ark.utils.load_utils as load_utils
import ark.utils.misc_utils as misc_utils
Expand Down
5 changes: 3 additions & 2 deletions ark/phenotyping/post_cluster_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import matplotlib.pyplot as plt
import os

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

from ark.utils import data_utils, load_utils, plot_utils
Expand Down
2 changes: 1 addition & 1 deletion ark/phenotyping/post_cluster_utils_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import pytest

import numpy as np
import pandas as pd
import pytest
import skimage.io as io

from ark.phenotyping import post_cluster_utils
Expand Down
9 changes: 3 additions & 6 deletions ark/segmentation/marker_quantification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@

import numpy as np
import pandas as pd

import xarray as xr

from skimage.measure import regionprops, regionprops_table

from ark.utils import io_utils, load_utils, misc_utils, segmentation_utils
from ark.segmentation.signal_extraction import EXTRACTION_FUNCTION
from ark.segmentation.regionprops_extraction import REGIONPROPS_FUNCTION

import ark.settings as settings
from ark.segmentation.regionprops_extraction import REGIONPROPS_FUNCTION
from ark.segmentation.signal_extraction import EXTRACTION_FUNCTION
from ark.utils import io_utils, load_utils, misc_utils, segmentation_utils


def get_single_compartment_props(segmentation_labels, regionprops_base,
Expand Down
15 changes: 6 additions & 9 deletions ark/segmentation/marker_quantification_test.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import copy
import numpy as np
import os
import pytest
import skimage.io as io
import tempfile
import xarray as xr

import numpy as np
import pytest
import skimage.io as io
import skimage.morphology as morph
import xarray as xr
from skimage.morphology import erosion
from skimage.measure import regionprops

from ark.segmentation import marker_quantification
from ark.utils import misc_utils
from ark.utils import test_utils

import ark.settings as settings
from ark.segmentation import marker_quantification
from ark.utils import misc_utils, test_utils


def test_get_single_compartment_props():
Expand Down
2 changes: 0 additions & 2 deletions ark/segmentation/regionprops_extraction.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import copy

import numpy as np
import pandas as pd

from skimage.measure import label, moments, regionprops_table


Expand Down
5 changes: 1 addition & 4 deletions ark/segmentation/regionprops_extraction_test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import copy

import numpy as np
import pandas as pd
import xarray as xr

from skimage.draw import ellipse
from skimage.measure import moments, regionprops, regionprops_table
from skimage.measure import regionprops

import ark.settings as settings
import ark.segmentation.regionprops_extraction as regionprops_extraction


Expand Down
3 changes: 1 addition & 2 deletions ark/segmentation/signal_extraction_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import numpy as np
import xarray as xr
from skimage.measure import regionprops

from ark.segmentation import signal_extraction
from ark.utils import synthetic_spatial_datagen

from skimage.measure import regionprops


def test_positive_pixels_extraction():
# sample params
Expand Down
3 changes: 2 additions & 1 deletion ark/spLDA/processing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import ark.settings as settings
import ark.spLDA.processing as pros
from ark.utils.misc_utils import verify_in_list
from ark.utils.test_utils import make_cell_table
from ark.utils.spatial_lda_utils import within_cluster_sums
from ark.utils.test_utils import make_cell_table

# Generate a test cell table
N_CELLS = 1000
TEST_CELL_TABLE = make_cell_table(N_CELLS)
Expand Down
6 changes: 3 additions & 3 deletions ark/utils/_bootstrapping.pyx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from cython cimport cdivision, boundscheck, wraparound
from cpython.mem cimport PyMem_Malloc, PyMem_Free
from cpython.mem cimport PyMem_Free, PyMem_Malloc
from cython cimport boundscheck, cdivision, wraparound

import numpy as np
cimport numpy as np

cimport numpy as np
from libc.stdlib cimport rand
from libc.string cimport memset

Expand Down
13 changes: 7 additions & 6 deletions ark/utils/data_utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from optparse import Option
import math
import os
import pathlib
from typing import List, Optional, Union
import math
import shutil
from typing import List, Union

import datasets
import feather
import skimage.io as io
import numpy as np
import skimage.io as io
import xarray as xr
from tqdm.notebook import tqdm_notebook as tqdm
import datasets
import shutil

from ark import settings
from ark.utils import load_utils
from ark.utils.misc_utils import verify_in_list
Expand Down
23 changes: 11 additions & 12 deletions ark/utils/data_utils_test.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import numpy as np
import os
import pathlib
import tempfile
from shutil import rmtree
import pytest

import feather
import numpy as np
import pandas as pd
import xarray as xr
import pytest
import skimage.io as io
import pathlib
from ark.utils import data_utils, test_utils
from ark.utils.data_utils import (
download_example_data,
generate_and_save_cell_cluster_masks,
generate_and_save_pixel_cluster_masks,
relabel_segmentation,
label_cells_by_cluster
)
import xarray as xr

from ark import settings
from ark.utils import data_utils, test_utils
from ark.utils.data_utils import (download_example_data,
generate_and_save_cell_cluster_masks,
generate_and_save_pixel_cluster_masks,
label_cells_by_cluster, relabel_segmentation)


def test_save_fov_images():
Expand Down
21 changes: 10 additions & 11 deletions ark/utils/deepcell_service_utils.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import os
import time
import warnings
from concurrent.futures import ThreadPoolExecutor
from io import BytesIO
from json import JSONDecodeError
import os
from pathlib import Path
from urllib.parse import unquote_plus
from zipfile import ZIP_DEFLATED, ZipFile

import numpy as np
import requests
from requests.adapters import HTTPAdapter
from requests.exceptions import RetryError
from requests.packages.urllib3.util import Retry
import time
from tqdm.notebook import tqdm
from urllib.parse import unquote_plus
import warnings
from concurrent.futures import ThreadPoolExecutor
import numpy as np
from scipy import stats
from skimage import io
from tifffile import imread
from io import BytesIO
from ark.utils import misc_utils
from zipfile import ZipFile, ZIP_DEFLATED
from tqdm.notebook import tqdm

from ark.utils import io_utils, misc_utils


Expand Down
Loading