(*Read Data from File*)
dateBH=Import["calea catre fisier\\DataBHFilteredFluxRedshift.csv"];
Length[dateBH]
redshiftDistribution=Abs[Flatten[Reap[Do[Sow[dateBH[[i,7]]],{i,Length[dateBH]}]][[2]],1]];
massDistribution=Flatten[Reap[Do[Sow[dateBH[[i,16]]],{i,Length[dateBH]}]][[2]],1];

(*Read Data from File*)
deExportat=Histogram[redshiftDistribution,{0.004},Frame->True, PlotRange->All,FrameLabel->{"z", "N"},FrameStyle->Directive[Black,FontFamily->"Times",FontSize->20],FrameTicksStyle->Thick]
Export["calea catre fisier\\RedshiftDistribution.pdf",deExportat];

(*------------ Log N Log z -------------*)
intervalNr=10;
numarSelectieCompleta=Range[intervalNr];numar=numarSelectieCompleta;
minInterval=Log[10,Min[redshiftDistribution]]
maxInterval=Log[10,Max[redshiftDistribution]]
flux=Drop[Table[(10^i),{i,minInterval,maxInterval,((maxInterval-minInterval)/intervalNr)}],1]
Do[numarSelectieCompleta[[i]]=Flatten[Reap[Do[If[dateBH[[j,7]]≥flux[[i]],Sow[dateBH[[j]]]],{j,Length[dateBH]}]][[2]],1],{i,Length[flux]}];
Do[numar[[i]]=Length[numarSelectieCompleta[[i]]],{i,Length[numar]}]
numar

(*------------ Log N Log S -------------*)
datele=Transpose[{flux,numar}]
La2microni=ListPlot[datele,Frame->True, PlotRange->All,FrameLabel->{"(Subscript[S, 2  μm])(Jy)", "N"},PlotStyle->{PointSize[0.01],RGBColor[0,0,0]}]

(*------------ Select down to 0.03 Jy and redshift 2 -------------*)
dateBHSelected=Flatten[Reap[Do[If[dateBH[[i,14]]>0.03&&dateBH[[i,7]]<2,Sow[dateBH[[i]]]],{i,Length[dateBH]}]][[2]],1];
Length[dateBHSelected]

(*------------ SRedshift vs Log Mass -------------*)
datele=Transpose[{redshiftDistribution,Log[10,massDistribution]}];
redshiftVSMassBH=ListPlot[datele,Frame->True, PlotRange->All,FrameLabel->{"redshift", "Log M [(Subscript[M, ⊙])]"},PlotStyle->{PointSize[0.004],RGBColor[0,0.5,1]},FrameStyle->Directive[Black,FontFamily->"Times",FontSize->20],FrameTicksStyle->Thick]