-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSphSort.py
More file actions
1600 lines (1273 loc) · 47.7 KB
/
Copy pathSphSort.py
File metadata and controls
1600 lines (1273 loc) · 47.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 19 15:46:49 2020
@author: dexter
"""
import numpy as np
import pickle
import matplotlib.pyplot as plt
from numpy.linalg import inv
import os
from SphRead import *
__all__ = ["remove_value","trim_value","replace_value", "replace_outlier",
"str_zipping","str_zipping_generic","remove_item", "add_item",
"outliers",
"selection_generic","zone_in_2D","cherry_pick" ,"sigma_clip",
"cpt_seperator_demo",
"cpt_classifier_demo", "plus_minus_seperator", "vdis_match",
"LTG_ETG_seperator", "prop_seperation"]
__author__="Dexter S.-H. Hon"
#%% tested
def remove_value(input_array,value_list):
"""
Remove the specfied value in an numpy array.
Parameters
----------
input_array : 1D numpy array
The input.
value_list : list
The indices of value to be removed .
Returns
-------
An resized numpy array without the value inside.
"""
value = []
input_array = list(input_array)
for j in range(len(value_list)):
value.append(input_array[value_list[j]])
for i in range(len(value)):
input_array.remove(value[i])
temp=np.array(input_array)
return temp
#%% tested
def trim_value(input_array,value):
"""
Trim down an numpy array by removing a specific value.
Parameters
----------
input_array : 1D numpy array
The input.
value : str, float
The value to be removed.
Returns
-------
An resized numpy array without the value inside.
"""
temp = []
for i in range(np.size(input_array)):
if input_array[i] == value:
pass
else:
temp.append(input_array[i])
temp=np.array(temp)
return temp
#%% tested
def replace_value(input_array,value1,value2):
"""
Replace the sepcfied value in an numpy array.
Parameters
----------
input_array : 1D numpy array
The input.
value1 : str, float
The value to be replaced.
value2 : str, float
The value to substitue.
Returns
-------
An new numpy array with the replaced value inside.
"""
temp = []
for i in range(np.size(input_array)):
if input_array[i] == value1:
temp.append(value2)
else:
temp.append(input_array[i])
temp=np.array(temp)
return temp
#%% tested
def replace_outliers(input_array,val,condition="<",replace='median'):
"""
A function to replace all elements satisfying
Parameters
----------
input_array : list, 1D numpy array
DESCRIPTION.
condition : bool
DESCRIPTION.
replace : str, optional
The value to replace:
"median": The median value of the array,
"mean": The average value of the array,
"zero": replace it with 0
The default is 'median'.
Returns
-------
A replacement array.
"""
#find the outliers
if condition == '<':
boolArr = (input_array < val)
elif condition == ">":
boolArr == (input_array < val)
# get the index array
index = np.where(boolArr)
# replace value
if replace == "median":
repl_val = np.median(input_array)
elif replace == "mean":
repl_val = np.average(input_array)
elif replace == "zero":
repl_val = 0.0
else:
TypeError("Huh??")
#print(index)
#replace the outliers
for i in range(len(index[0])):
input_array[index[0][i]] = repl_val
return input_array
#%% tested
def str_zipping(list1,list2,zip_symbol=""):
"""
Convert the content of two lists into str and link them together.
e.g.: str_zipping([1,2,4],[4,5,3],zip_symbol = '+')
>>> ['1+4','2+5','4+3']
Parameters
----------
list1, list2 : list
The lists to be conjoin. They must have the same dimensions
zip_symbol : str
The symbol in which you want to add in between the elements.
The default is "".
Returns
-------
A list of conjoined elements.
"""
list1, list2 = list(list1), list(list2)
if len(list1) == len(list2): # matching list dimension
pass
else:
ValueError
list_product = []
for i in range(len(list1)):
list_product.append(str(list1[i])+zip_symbol+str(list2[i]))
return list_product
#%%tested
def str_zipping_generic(*args):
"""
Convert the content of multiple lists into str and link them together.
e.g.: str_zipping('(',[1,2,4], '+', [4,5,3],')')
>>> ['(1+4)','(2+5)','(4+3)']
Parameters
----------
*args: list or str or int
The objects to be conjoin. The lists must have the same dimensions.
Otherwise, any str or int should be one per entry.
Returns
-------
A list that looks like:
['(1+4)','(2+5)','(4+3)']
"""
len_doc, master_list = [], []
list_product = []
for i in args:
if type(i) == list:
len_doc.append(len(i))
#check input length consistency
for i in len_doc:
if len_doc == i:
pass
else:
ValueError
#multiply singular element into list
for i in args:
if type(i) == list:
master_list.append(i)
elif type(i) == str:
A = []
for j in range(len_doc[0]):
A.append(i)
master_list.append(A)
#zipping
for i in range(len_doc[0]):
string = ''
for j in range(len(master_list)):
string = string + str(master_list[j][i])
list_product.append(string)
return list_product
#%% tested
def remove_item(input_list_name,keyword_list):
"""
A method to remove lists base on specified keywords,
from the galaxy bundle.
----------
input_list_name: str
The galaxy bundle
keyword_list: list
A list containing the names of the galaxy
Return
------
Galaxy Bundle
"""
sample = read_list(input_list_name)
row_list=[]
row_example=[]
for item in keyword_list:
keyword = item
for row in range(len(sample)):
if sample[row][0] == keyword:
print("Bingo",row,keyword)
row_list.append(row)
row_example.append(sample[row])
pass
else:
pass
sample2 = sample
for i in range(len(row_example)):
sample2.remove(row_example[i])
#print(row_list)
#for i in row_list:
## print(sample[i])
# sample2.remove(sample[i])
## #(sample[i])
# print(i)
# print(len(sample2),len(sample))
with open(input_list_name, 'wb') as f:
pickle.dump(sample2, f)
return sample2
#%% tested
def add_item(parent_list_name, target_list_name, keyword_list):
"""
A method to add lists into a bundle based on specified keywords.
----------
parent_list_name: str
The parent galaxy bundle.
target_list_name: str
The target bindle.
keyword_list: list
A list containing the names of the galaxy.
Return
------
New target list
"""
parent_sample = read_list(parent_list_name)
target_sample = read_list(target_list_name)
for item in keyword_list:
keyword = item
for row in range(len(parent_sample)):
if parent_sample[row][0] == keyword:
target_sample.append(parent_sample[row])
else:
pass
with open(target_list_name, 'wb') as f:
pickle.dump(target_sample, f)
return target_sample
#%% maybe useless
def sum_cpt_mag(input_list_name, sum_range="all"):
"""
A method to sum up the magnitude of each component of a galaxy.
Parameters
----------
input_list_name : str
The name of the galaxy bundle.
sum_range : str or list , optional
The range to sum up. The default is "all".
e.g. [1,5], sum up the magnitude from elemnet 1 to 5
Returns
-------
mag_list.
The magnitude list.
"""
parent_sample = read_list(parent_list_name)
mag_list = []
for i in range(len(parent_sample)):
L=0 # The luminosity
j= 4 # The first magnitude in a bundle is at position 4
while j < len(parent_sample[i]):
mag_cpt = parent_sample[i][j]# define the magnitude of the cpt
L = L+10**(mag_cpt/-2.5) #update the luminosity
j+3
mag = -2.5*np.log10(L)
mag_list.append(mag)
return mag_list
#%% tested
def outlier_detect(input_array, value,direction="<"):
"""
A function to find the indices of the outliers
Parameters
----------
input_array : 1D list or ndarray
input.
value : float
The value to detect outliers.
direction : str, optional
The condition to detect outliers. The default is "<".
Returns
-------
index : 1d ndarray
A list of indices.
"""
for i in range(len(input_array)):
if direction == "<":
boolArr = (input_array < value)
index = np.where(boolArr)[0]
elif direction == ">":
boolArr = (input_array > value)
index = np.where(boolArr)[0]
return index
#%% need to be thrown out
def outliers(name,input_array,limit, direction="large"):
"""
A generic function to select outliers larger than the limit
----------
name : str
The name of the outlier
input_array : 1D numpy array
The array in question
limit : float
The outlier cut.
direction: str
Define which direction of outlier to select.
The options are "large" or "small".
The default is "large".
Return
------
Dictionary containing the selected sample name and values
"""
#the outlier name and attribute
outliers_name, outliers =[], []
if direction == "large":
for row in range(len(input_array)):
if (input_array[row] > limit):
outliers_name.append(name[row])
outliers.append(input_array[row])
else:
pass
elif direction == "small":
for row in range(len(input_array)):
if (input_array[row] < limit):
outliers_name.append(name[row])
outliers.append(input_array[row])
else:
pass
return {"name":outliers_name, "Dist":outliers}
#%% tested
def selection_generic(input_list_x, input_list_y, func,
direction="low", axis="y"):
"""
A generic method (2D) to select a set of sample base on a cut.
Parameters
----------
input_list: 1D numpy array
The quantity to compare the cut with.
func: 1D numpy array
An function with the same dimension as the input list.
direction: str
The direction of the selection
The options are either "low" or "high".
The default is "low".
axis: str
The axis of interest.
The options are either "x" or "y"
The default is "y"
Returns
-------
Bag: Dict
{index:[1,4,5],
bag:[[],[]...]}
"""
index_list,bag_list_y, bag_list_x=[],[],[]
match_list_dim(input_list_x, func)
match_list_dim(input_list_x, input_list_y)
outliers
if axis == "y":
if direction == "high":
for i in range(len(input_list_y)):
if input_list_y[i] > func[i]:
index_list.append(i)
bag_list_x.append(input_list_x[i])
bag_list_y.append(input_list_y[i])
elif direction == "low":
for i in range(len(input_list_y)):
if input_list_y[i] < func[i]:
index_list.append(i)
bag_list_x.append(input_list_x[i])
bag_list_y.append(input_list_y[i])
elif axis == "x":
if direction == "high":
for i in range(len(input_list_x)):
if input_list_x[i] > func[i]:
index_list.append(i)
bag_list_x.append(input_list_x[i])
bag_list_y.append(input_list_y[i])
elif direction == "low":
for i in range(len(input_list_x)):
if input_list_x[i] < func[i]:
index_list.append(i)
bag_list_x.append(input_list_x[i])
bag_list_y.append(input_list_y[i])
Bag = {'index':index_list,
'bag_x':bag_list_x,
'bag_y':bag_list_y
}
return Bag
#%%
# need to make zone_in_generic
# that does not loop every element
def zone_in_2D(input_matrix,low_bound=None,up_bound=None):
"""
A function to select the sample within
low_bound and up_bound in 2D.
This function loop through every elements.
Parameters
----------
input_matrix : list
The 2D input list.
low_bound : list
The list of lower bound.
This need to be the same length as the
input_matrix.
The default is [-1.0*np.inf,...]
up_bound : TYPE
The list of lower bound.
This need to be the same length as the
input_matrix.
The default is [-1.0*np.inf,...].
Returns
-------
The dictionary that contain the indices, and the data matrix.
"""
index_list, bag_list, bag_list_y, bag_list_x=[],[],[], []
bag = {}
dimension = len(input_matrix)
# produce array of inf
if low_bound == None:
low_bound = np.repeat(-1.0*np.inf,dimension)
if up_bound == None:
up_bound = np.repeat(np.inf,dimension)
# check if the dimension matches
match_list_dim(low_bound, input_matrix)
match_list_dim(up_bound, input_matrix)
for j in range(len(input_matrix[0])):
if input_matrix[0][j] > low_bound[0] and \
input_matrix[1][j] > low_bound[1] and \
input_matrix[0][j] < up_bound[0] and \
input_matrix[1][j] < up_bound[1]:
index_list.append(j)
bag_list_x.append(input_matrix[0][j])
bag_list_y.append(input_matrix[1][j])
bag_list.append(bag_list_x)
bag_list.append(bag_list_y)
bag["index"] = index_list
bag["data"] = bag_list
return bag
#%% tested
def seperator_label_generic(bundle,
compartment_label,label_entry=None):
"""
A generic method to compartmentalise a bundle.
This function convert a parent list bundle into a list that contain
a number of dictionaries, based on labels.
Example:
[[name1,label1,value1,label2,value2,...],[...],...]
-->input compartment_label = ["A","B","C",..]
-->[{"A_index": [...],
"A_sample":[[...],...]},
{"B_index":[...].
"B_sample":[[...],...] }...]
Parameters
----------
bundle : list
A list bundle.
compartment_label : list
A list of label for matches.
label_entry : float or int or list
The location of the label entries.
The default is None. We loop through the whole sample entry to FIND
the desired label.
If the input is float, we assume all label_entries are in the
same position. e.g. Second column, input:1
If the input is a list, we loop through the list and extract
information based on the location provided by a list.
e.g. [1,3,6], first loop: 2 nd column, second loop: 4th column, and
third loop, 6th column.
Returns
-------
new_bundle.
A new bundle that contain the compartmentalised data.
"""
# check the nature of the label_entry
new_bundle = []
# loop through the list of labels
for i in range(len(compartment_label)):
Dict ={}
index, data = [], []
# Loop through everything if label_entry is None
if label_entry == None:
for j in range(len(bundle)):
for k in range(len(bundle[j])):
if bundle[j][k] == compartment_label[i]:
index.append(j)
data.append(bundle[j])
pass
# Look up a fixed column if label_entry is int or float
elif type(label_entry) == float or type(label_entry) == int:
for j in range(len(bundle)):
if bundle[j][int(label_entry)] == compartment_label[i]:
index.append(j)
data.append(bundle[j])
pass
# Look up specific column according to label_entry list
elif type(label_entry) == list:
#check if the dimension of label_entry and compartment_label matches
match_list_dim(compartment_label, label_entry)
for j in range(len(bundle)):
if bundle[j][i] == compartment_label[i]:
index.append(j)
data.append(bundle[j])
pass
Dict[compartment_label[i]+"_index"] = index
Dict[compartment_label[i]] = data
new_bundle.append(Dict)
return new_bundle
#%% tested
def cherry_pick(index_list,parent_list):
"""
A generic method to cherry pick a set of subsample, given a list of indices
to select from.
Parameters
----------
index_list : 1D list
The indices of the subsample.
parent_list : 1D list
The material of which one select from.
Returns
-------
subsample : 1D list
The result subsample.
"""
subsample = []
i=0
for i in range(len(index_list)):
subsample.append(parent_list[index_list[i]])
return subsample
#%% tested (need to account for misalign average and median later)
def sigma_clip(input_array,sigma=3):
"""
A function to remove data points beyond x sigma limit
Parameters
----------
input_array : 1d ndarray
inout.
sigma : TYPE, optional
The multiplier for sigma. The default is 3.
Returns
-------
output_array2 : 1d ndarray
An array with all outliers removed.
"""
#check if the list is empty
if len(input_array) == 0:
median_g, std_g = np.nan, np.nan
else:
# calculate median and the standard deviation
median_g, std_g = np.median(input_array), np.std(input_array)
# remove the elements beyond the limit
output_array1 = np.delete(input_array, outlier_detect(
input_array, median_g+sigma*std_g,">"))
output_array2 = np.delete(output_array1, outlier_detect(
output_array1, median_g-sigma*std_g,"<"))
return output_array2
#%% tested
def sigma_clip2D(input_array_x,input_array_y,sigma=3):
"""
Same method as 'sigma_clip' but for 2D data.
The determining array for outliers is the input_array_x
Parameters
----------
input_array_x : TYPE
DESCRIPTION.
input_array_y : TYPE
DESCRIPTION.
sigma : TYPE, optional
DESCRIPTION. The default is 3.
Returns
-------
output_array2_x : TYPE
DESCRIPTION.
output_array2_y : TYPE
DESCRIPTION.
"""
#check if the list is empty
if len(input_array_x) == 0:
input_array_x.append(np.nan)
input_array_y.append(np.nan)
median_g, std_g = np.nan, np.nan
else: # calculate median and the standard deviation
median_g, std_g = np.median(input_array_x), np.std(input_array_x)
if type(input_array_x) == list and type(input_array_y) == list:
input_array_x = np.array(input_array_x)
input_array_y = np.array(input_array_y)
# remove the elements beyond the limit
index1 = outlier_detect(input_array_x, median_g+sigma*std_g,">")
output_array1_x = np.delete(input_array_x, index1)
output_array1_y = np.delete(input_array_y, index1)
index2 = outlier_detect(output_array1_x, median_g-sigma*std_g,"<")
output_array2_x = np.delete(output_array1_x, index2)
output_array2_y = np.delete(output_array1_y, index2)
return output_array2_x, output_array2_y
#%% tested
def morph_str_selection(index_list,morph_list):
"""
Seperate an index list by the morphology type E, S0, or S string indicator.
Parameters
----------
index_list : 1d list
The target index list.
morph_list : 1D list
The corresponding morphology list to the index list.
Returns
-------
morph_dict: dict
example
{"E": [index_list[1],index_list[6],index_list[9],...],
"S0": [index_list[2],index_list[4],index_list[8],...],
"S": [index_list[3],index_list[6],index_list[10],...] }
"""
morph_dict = {}
E_list,S0_list,S_list = [], [], []
for i in range(len(index_list)):
if "E" in morph_list[i]:
E_list.append(index_list[i])
elif "0" in morph_list[i]:
S0_list.append(index_list[i])
else:
S_list.append(index_list[i])
morph_dict["E"] = E_list
morph_dict["S0"] = S0_list
morph_dict["S"] = S_list
return morph_dict
#%% tested
def cpt_seperator_demo(input_list_name):
"""
A demo function for seperating galaxy components to different bins.
It create the candidate list for component assignment.
...
Parameters
----------
input_list_name : str
The file name of the galaxy bundle.
Return
-------
"""
sample = read_list(input_list_name) #sample package
master_Bulge_can, master_Bulge_can_index = [], []
master_CoreBulge_can, master_CoreBulge_can_index = [], []
master_Disk_can1, master_Disk_can2, master_Disk_can3 = [],[],[]
master_Disk_can1_index, master_Disk_can2_index, master_Disk_can3_index = [],[],[]
master_Bar_can, master_Bar_can_index = [], []
master_Ring_can, master_Ring_can_index = [],[]
master_Total_mag_can, master_Total_mag_can_index = [], []
master_Bulge_can_row = []
master_CoreBulge_can_row = []
master_Disk_can1_row = []
master_Disk_can2_row = []
master_Disk_can3_row = []
master_Bar_can_row = []
master_Ring_can_row = []
master_Total_mag_can_row = []
for number in range(len(sample)):
#print(sample[number])
sample_indi = sample[number] #indivdual sample
Bulge_can,Bulge_can_index = [], []
CoreBulge_can,CoreBulge_can_index = [],[]
Disk_can1, Disk_can2, Disk_can3, Disk_can1_index, Disk_can2_index, Disk_can3_index = [],[],[],[],[],[]
Bar_can, Bar_can_index = [], []
Ring_can, Ring_can_index = [],[]
Total_mag_can, Total_mag_can_index = [],[]
Bulge_can_row = []
CoreBulge_can_row = []
Disk_can1_row = []
Disk_can2_row = []
Disk_can3_row = []
Bar_can_row = []
Ring_can_row = []
Total_mag_can_row = []
for index in range(len(sample_indi)):
###############################
# Bulge and Lens
if sample_indi[index] == "Sersic":
Bulge_can.append(sample_indi[index+1])
Bulge_can_index.append(index)
Bulge_can_row.append(number)
#print(sample_indi[0],"Sersic")
###############################
# CoreBulge
if sample_indi[index] == "CoreSersic":
CoreBulge_can.append(sample_indi[index+1])
CoreBulge_can_index.append(index)
CoreBulge_can_row.append(number)
#print(sample_indi[0],"CoreSersic")
###############################
# nucDisk, intDisk, extDisk
elif sample_indi[index] == "Exp":
Disk_can1.append(sample_indi[index+1])
Disk_can1_index.append(index)
Disk_can1_row.append(number)
#print(sample_indi[0],"Exp")
elif sample_indi[index] == "BrokenExp":
Disk_can2.append(sample_indi[index+1])
Disk_can2_index.append(index)
Disk_can2_row.append(number)
#print(sample_indi[0],"BrokenExp")
elif sample_indi[index] == "InclExp":
Disk_can3.append(sample_indi[index+1])
Disk_can3_index.append(index)
Disk_can3_row.append(number)
#print(sample_indi[0],"InclExp")
################################
# primBar, secBar
elif sample_indi[index] == "Ferrer":
Bar_can.append(sample_indi[index+1])
Bar_can_index.append(index)
Bar_can_row.append(number)
#print(sample_indi[0],"Ferrer")
################################
# Anse, Rings
elif sample_indi[index] == "Gauss":
Ring_can.append(sample_indi[index+1])
Ring_can_index.append(index)
Ring_can_row.append(number)
#print(sample_indi[0],"Gauss")
################################
# Anse, Rings
elif sample_indi[index] == "Total_mag":
Total_mag_can.append(sample_indi[index+1])
Total_mag_can_index.append(index)
Total_mag_can_row.append(number)
#print(sample_indi[0],"Gauss")
################################
master_Bulge_can.append(Bulge_can),
master_Bulge_can_index.append(Bulge_can_index)
master_CoreBulge_can.append(CoreBulge_can),
master_CoreBulge_can_index.append(CoreBulge_can_index)
master_Disk_can1.append(Disk_can1),
master_Disk_can1_index.append(Disk_can1_index)
master_Disk_can2.append(Disk_can2),
master_Disk_can2_index.append(Disk_can2_index)
master_Disk_can3.append(Disk_can3),
master_Disk_can3_index.append(Disk_can3_index)
master_Bar_can.append(Bar_can),
master_Bar_can_index.append(Bar_can_index)
master_Ring_can.append(Ring_can),
master_Ring_can_index.append(Ring_can_index)
master_Total_mag_can.append(Total_mag_can),
master_Total_mag_can_index.append(Total_mag_can_index)
master_Bulge_can_row.append(Bulge_can_row)
master_CoreBulge_can_row.append(CoreBulge_can_row)
master_Disk_can1_row.append(Disk_can1_row)
master_Disk_can2_row.append(Disk_can2_row)
master_Disk_can3_row.append(Disk_can3_row)
master_Bar_can_row.append(Bar_can_row)
master_Ring_can_row.append(Ring_can_row)
master_Total_mag_can_row.append(Total_mag_can_row)
return{"master_Bulge_can":master_Bulge_can,
"master_Bulge_can_index":master_Bulge_can_index,
"master_Bulge_can_row":master_Bulge_can_row,
"master_CoreBulge_can":master_CoreBulge_can,
"master_CoreBulge_can_index":master_CoreBulge_can_index,
"master_CoreBulge_can_row":master_CoreBulge_can_row,
"master_Disk_can1":master_Disk_can1,
"master_Disk_can1_index":master_Disk_can1_index,
"master_Disk_can1_row":master_Disk_can1_row,
"master_Disk_can2":master_Disk_can2,
"master_Disk_can2_index":master_Disk_can2_index,
"master_Disk_can2_row":master_Disk_can2_row,
"master_Disk_can3":master_Disk_can3,
"master_Disk_can3_index":master_Disk_can3_index,
"master_Disk_can3_row":master_Disk_can3_row,
"master_Bar_can":master_Bar_can,
"master_Bar_can_index":master_Bar_can_index,
"master_Bar_can_row":master_Bar_can_row,
"master_Ring_can":master_Ring_can,
"master_Ring_can_index":master_Ring_can_index,
"master_Ring_can_row":master_Ring_can_row,
"master_Total_mag_can":master_Total_mag_can,
"master_Total_mag_can_index":master_Total_mag_can_index,
"master_Total_mag_can_row":master_Total_mag_can_row}
#%% tested
def cpt_classifier_demo(input_list_name, input_sep_dict ,output_list_name,
override_instruction=[]):
"""
A demo function for interpret the nature of the analytic function
describing a galaxy.
...
The scheme of interpretation is as following: