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

Minor bug fixes #2

Merged
merged 7 commits into from
Mar 30, 2015
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
26 changes: 15 additions & 11 deletions scimes/orion2scimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import numpy as np
import math
import aplpy
import random

from matplotlib import pyplot as plt

from astrodendro import Dendrogram, ppv_catalog
from astropy import units as u
Expand Down Expand Up @@ -64,13 +67,13 @@ def make_asgn(dendro, data_file, cores_idx = [], tag = '_', collapse = True):

# Making the assignment cube
if len(data.shape) == 3:
asgn = np.zeros(data.shape, dtype = int32)
asgn = np.zeros(data.shape, dtype = np.int32)

if len(data.shape) == 4:
asgn = np.zeros((data.shape[1],data.shape[2],data.shape[3]), dtype = int32)
asgn = np.zeros((data.shape[1],data.shape[2],data.shape[3]), dtype = np.int32)

for i in cores_idx:
asgn[where(d[i].get_mask(shape = asgn.shape))] = i
asgn[np.where(d[i].get_mask(shape = asgn.shape))] = i


# Write the fits file
Expand All @@ -85,8 +88,8 @@ def make_asgn(dendro, data_file, cores_idx = [], tag = '_', collapse = True):

asgn_map = np.amax(asgn.data, axis = 0)

matshow(asgn_map, origin = "lower")
colorbar()
plt.matshow(asgn_map, origin = "lower")
plt.colorbar()


return
Expand All @@ -95,13 +98,14 @@ def make_asgn(dendro, data_file, cores_idx = [], tag = '_', collapse = True):



path = '/Volumes/Zeruel_data/ORION/'
path = './'
#path = '/Volumes/Zeruel_data/ORION/'
#path = '/Users/Dario/Documents/dendrograms/'
filename = path+'orion'
filename = os.path.join(path, 'orion')

do_make = False
do_catalog = False
do_load = False
do_make = True
do_catalog = True
do_load = True


if do_make:
Expand All @@ -115,7 +119,7 @@ def make_asgn(dendro, data_file, cores_idx = [], tag = '_', collapse = True):
data = hdu.data
hd = hdu.header

if size(shape(data))==4:
if data.ndim==4:
data = data[0,:,:,:]


Expand Down
9 changes: 7 additions & 2 deletions scimes/scimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@

from matplotlib import pyplot as plt

from sklearn.cluster import spectral_clustering
from itertools import combinations
from astrodendro import Dendrogram, ppv_catalog
from astropy import units as u
from astropy.stats import median_absolute_deviation as mad

from sklearn import metrics
from spectral import spectral_clustering
from skimage.measure import regionprops


def mat_smooth(Mat, scalpar = 0, lscal = False):
Expand Down
14 changes: 7 additions & 7 deletions scimes/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

import numpy as np

from ..base import BaseEstimator, ClusterMixin
from ..utils import check_random_state, as_float_array, deprecated
from ..utils.extmath import norm
from ..metrics.pairwise import pairwise_kernels
from ..neighbors import kneighbors_graph
from ..manifold import spectral_embedding
from .k_means_ import k_means
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.utils import check_random_state, as_float_array, deprecated
from sklearn.utils.extmath import norm
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.neighbors import kneighbors_graph
from sklearn.manifold import spectral_embedding
from sklearn.cluster.k_means_ import k_means


def discretize(vectors, copy=True, max_svd_restarts=30, n_iter_max=20,
Expand Down