Skip to content

Commit

Permalink
Push for DOI
Browse files Browse the repository at this point in the history
  • Loading branch information
tboudreaux committed Sep 28, 2017
1 parent d7de2b6 commit d0bea44
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,5 +1,5 @@
# astroSynth
Version: 0.5.3.9 - Beta <br>
Version: 0.5.4.2 - Beta <br>
A very basic synthetic generation suite

# Installation
Expand Down
41 changes: 23 additions & 18 deletions astroSynth/Objects/POS.py
Expand Up @@ -13,6 +13,7 @@
from scipy.signal import spectrogram
from multiprocessing import Pool
from scipy import misc
from contextlib import closing

class POS():
def __init__(self, prefix='SynthStar', mag_range=[10, 20], noise_range=[0.05, 0.1],
Expand Down Expand Up @@ -354,10 +355,15 @@ def __get_spect__(self, n=0, s=500, dim=50,
Amps.append(Amp)
self.__Debug_log__('{}:{}'.format(7, Index), arg='Max amp is: {}'.format(max(Amp)))
# Amps = self.__compress_spect__(Amps)
self.__Debug_log__(10, arg='UD: {}, LD: {}'.format(UD_stretch, LD_stretch))
out_tuple = (np.repeat(np.repeat(Amps, LD_stretch, axis=1),UD_stretch, axis=0),
Freq, self.targets[target_id][0][2], target_id, kwarg)
self.__Debug_log__('8:0 Amp Check', arg='Max amplitues of 0th Amp is: {}'.format(max(out_tuple[0][0])))
out_img = out_tuple[0]# misc.imresize(out_tuple[0], (dim, s), interp='cubic')
orig_max = out_tuple[0].max()
orig_min = out_tuple[0].min()
orig_range = orig_max - orig_min
out_img = misc.imresize(out_tuple[0], (dim, s), interp='cubic')
out_img = ((out_img * orig_range)/255.0)+orig_min
if Normalize is True:
# out_img = out_img/out_img.max()
out_img = out_img/(np.mean(out_img) - 1)
Expand Down Expand Up @@ -401,7 +407,7 @@ def get_ft_sub(self, n=0, sub_element=0, s=500, state_change=False, power_spec=T
comp_As = compress_to_1(out_tuple[1])
else:
comp_As = out_tuple[1]
out_tuple = (out_tuple[0], comp_As, out_tuple[2], self.int_name_ref[n])
out_tuple = (out_tuple[0], comp_As, out_tuple[2])#, self.int_name_ref[n])
return out_tuple

def __load_dump__(self, n=0, state_change=True):
Expand Down Expand Up @@ -629,18 +635,17 @@ def __batch_get_spect__(self, start=0, mem_size=1e9, step=1,
else:
num *= step
num += start
p = Pool(4)
data_inputs = range(start, num, step)
params = [data_inputs, s, dim, power_spec, Normalize]
pool_params = np.array(self.__gen_pool_params__(params)).T
pool_output = p.starmap(self.__spect_thread_retive__, pool_params)
pool_output = np.array(pool_output)
out_imigs = pool_output[:, 0]
out_freqs = pool_output[:, 1]
out_class = pool_output[:, 2]
out_tarid = pool_output[:, 3]
out_kwarg = pool_output[:, 4]
p.close()
with closing(Pool(4, maxtasksperchild=1000)) as p:
data_inputs = range(start, num, step)
params = [data_inputs, s, dim, power_spec, Normalize]
pool_params = np.array(self.__gen_pool_params__(params)).T
pool_output = p.starmap(self.__spect_thread_retive__, pool_params)
pool_output = np.array(pool_output)
out_imigs = pool_output[:, 0]
out_freqs = pool_output[:, 1]
out_class = pool_output[:, 2]
out_tarid = pool_output[:, 3]
out_kwarg = pool_output[:, 4]
return out_imigs, out_freqs, out_class, out_tarid, out_kwarg

def __gen_pool_params__(self, parameters):
Expand Down Expand Up @@ -706,11 +711,11 @@ def batch_get(self, batch_size=10, spect=False, s=None, dim=50, mem_size=1e9,

def __repr__(self):
out = list()
out.append(f"Survey Name: {self.prefix}")
out.append(f"Survey Size: {self.size}")
out.append(f"Survey Object Name: {self.name}")
out.append("Survey Name: {prefix}".format(prefix=self.prefix))
out.append("Survey Size: {size}".format(size=self.size))
out.append("Survey Object Name: {name}".format(self.name))
if self.verbose >= 1:
out.append(f'Noise Range: {self.noise_range[0]}->{self.noise_range[1]}')
out.append('Noise Range: {}->{}'.format(self.noise_range[0], self.noise_range[1]))

return '\n'.join(out)

Expand Down
6 changes: 3 additions & 3 deletions astroSynth/PVS.py
Expand Up @@ -120,7 +120,7 @@ def __debug_check__(self):
Returns:
N/A
"""
print('Version 0.5.3.9 Development')
print('Version 0.5.4.1 Development')

def __build_single__(self, phase_range=[0, np.pi], amp_range=[0, 1],
freq_range=[1e-7, 1], L_range=[1, 3]):
Expand Down Expand Up @@ -504,7 +504,7 @@ def __get_lc__(self, n=0, state_change=False):
file_num = -1
base = 0
if n == self.size - 1:
base = int(self.item_ref['-1'][0])
base = int(self.item_ref[-1][0])
file_num = -1
else:
for k in self.item_ref:
Expand Down Expand Up @@ -680,7 +680,7 @@ def load(self, directory='.', start=-1):
with open('{}/item_loc_meta.PVS'.format(directory), 'r') as f:
lines = [x.split(':') for x in f.readlines()]
for i in lines:
self.item_ref[i[0]] = [i[1], i[2]]
self.item_ref[int(i[0])] = [i[1], i[2]]
with open('{}/object_meta.PVS'.format(directory), 'r') as f:
lines = [x.split(':') for x in f.readlines()]
for i in lines:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -4,7 +4,7 @@
HERE = path.abspath(path.dirname(__file__))

setup(name='astroSynth',
version='0.5.3.9',
version='0.5.4.2',
description='Very Basic Astrophysics Synthetic Generation Suite',
url='https://github.com/tboudreaux/astroSynth.git',
author='Thomas Boudreaux',
Expand Down

0 comments on commit d0bea44

Please sign in to comment.