(*Read Data from File*)
dateBH=Import["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataBHFilteredFluxRedshift.csv"];
Length[dateBH]
(*Correct for the empty spaces*)
Do[
stringToCheck=Characters[ToString[dateBH[[kk,2]]]];
Do[If[stringToCheck[[i]]==" ",If[stringToCheck[[i+1]]==" ",stringToExport=Drop[stringToCheck,-(30-(i-1))];Break[]]],{i,1,29}];dateBH[[kk,2]]=StringJoin[stringToExport],{kk,Length[dateBH]}]
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataBHFilteredFluxRedshiftNew.csv",dateBH];

(*Extract the photometric data*)
dateBH=Import["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataBHFilteredFluxRedshiftNew.csv"];
date2Mass=Import["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\BrutData2micronAll.csv"];
Bindex=Table[0,{Length[dateBH]}];
Vindex=Table[0,{Length[dateBH]}];
FIR=Table[0,{Length[dateBH]}];
Radio=Table[0,{Length[dateBH]}];
Do[Do[If[dateBH[[i,2]]==date2Mass[[j,2]],Radio[[i]]=date2Mass[[j,13]]],{j,Length[date2Mass]}],{i,Length[dateBH]}]
Do[Do[If[dateBH[[i,2]]==date2Mass[[j,2]],FIR[[i]]=date2Mass[[j,14]]],{j,Length[date2Mass]}],{i,Length[dateBH]}]
(*Export Data*)
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataFIR.csv",FIR];
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataRadio.csv",Radio];

(*Extract the photometric data*)
Do[If[Radio[[i]]=="",Radio[[i]]=0],{i,Length[Radio]}]
Do[If[FIR[[i]]=="",FIR[[i]]=0],{i,Length[FIR]}]
Do[If[FIR[[i]]>0,FIR[[i]]=FIR[[i]]*1000],{i,Length[FIR]}]
(*Export Data*)
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataFIR.csv",FIR];
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataRadio.csv",Radio];

(*Extract the photometric data*)
Do[Do[If[dateBH[[i,2]]==date2Mass[[j,2]],Bindex[[i]]=date2Mass[[j,6]]],{j,Length[date2Mass]}],{i,Length[dateBH]}]
Do[Do[If[dateBH[[i,2]]==date2Mass[[j,2]],Vindex[[i]]=date2Mass[[j,7]]],{j,Length[date2Mass]}],{i,Length[dateBH]}]
(*Export Data*)
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataBindex.csv",Bindex];
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataVindex.csv",Vindex];

(*Colore index (B-V) and FIR/Radio*)
dateBH=Import["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\DataBHFilteredFluxRedshiftNew.csv"];
BminusV=Flatten[Reap[Do[If[dateBH[[i,18]]>0&&dateBH[[i,19]]>0,Sow[N[dateBH[[i,18]]-dateBH[[i,19]]]],Sow[0]],{i,Length[dateBH]}]][[2]],1];
FIRoverRadio=Flatten[Reap[Do[If[dateBH[[i,20]]>0&&dateBH[[i,21]]>0,Sow[N[dateBH[[i,20]]/dateBH[[i,21]]]],Sow[0]],{i,Length[dateBH]}]][[2]],1];
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\BminusV.csv",BminusV];
Export["C:\Users\Laurentiu\Google Drive\Proiecte\FractalSky\2micron\2RedshiftLimit\BHCatalog\FIRoverRadio.csv",FIRoverRadio];