In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
In [2]:
my_data = np.loadtxt('/home/mldantas/Google Drive/Doutorado/GAMAII/Catalogue/Match06_small_mags.csv',
delimiter=',', dtype=str)
In [3]:
my_dictionary = {}
for i in range(len(my_data[0, :])): # Converting numpy array into dictionary
my_dictionary[my_data[0, i]] = np.array(my_data[0 + 1:, i], dtype=str)
In [4]:
redshift = my_dictionary['Z'].astype(float)
fuv_band = my_dictionary['MAG_AB_FUV'].astype(float)
nuv_band = my_dictionary['MAG_AB_NUV'].astype(float)
r_band = my_dictionary['MAG_AB_R'].astype(float)
In [5]:
print redshift[[fuv_band>0]].shape
print fuv_band[[fuv_band>0]].shape
We need to remove all the spurious data here.
In [17]:
indexes = np.arange(redshift.size)
index_clean = indexes[(redshift>0.015)*(r_band>0)*(nuv_band>0)*(fuv_band>0)*((fuv_band-nuv_band)<50)]
In [18]:
print redshift[index_clean].size
In [19]:
my_clean_data = my_data[index_clean].astype(str)
In [21]:
print my_clean_data.shape
print my_clean_data[0,:] #checking if the header is ok!
In [22]:
my_df = pd.DataFrame(my_clean_data)
In [23]:
my_df.to_csv('../Catalogue/Match06_small_mags_clean.csv', sep=',', header=None, index=False)
In [ ]: