Libraries to be used


In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

Catalogue


In [2]:
my_data = np.loadtxt('myGAMA_ALL_AB_ABSOL_MAGS.csv', delimiter=',', dtype=str)

In [3]:
print my_data.shape


(43969, 175)

In [4]:
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 [5]:
redshift = my_dictionary['Z_HELIO'].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 [6]:
print redshift[[fuv_band>0]].shape
print fuv_band[[fuv_band>0]].shape


(42610,)
(42610,)

In [7]:
print redshift.shape
print fuv_band.shape


(43968,)
(43968,)

In [8]:
print redshift.size
print fuv_band.size


43968
43968

Cleaning the catalogue

We need to remove all the spurious data here.


In [9]:
indexes = np.arange(redshift.size)

In [10]:
index_clean = indexes[(redshift>0.015)*(r_band>0)*(nuv_band>0)*(fuv_band>0)*((fuv_band-nuv_band)<50)*((fuv_band-nuv_band)>(-20))]

In [11]:
print redshift[index_clean].size


41573

In [12]:
my_clean_data = my_data[index_clean].astype(str)

In [13]:
print my_clean_data.shape
#print my_clean_data[0,:]  #checking if the header is ok!


(41573, 175)

Saving my new catalogue in CSV


In [14]:
my_df = pd.DataFrame(my_clean_data)

In [15]:
my_df.to_csv('myGAMA_ALL_AB_ABSOL_MAGS_clean.csv', sep=',', header=None, index=False)

In [16]:
!pwd


/home/mldantas/Dropbox/DoutoradoIAG/GAMAZOO

In [ ]: