Optimal Estimations of Photometric Redshifts and SED Fitting Parameters  Purpose of SED (spectral energy distribution) fitting: find the age, mass, dust content of the galaxies  Objective: By creating Python modules, get the best estimate of photo z from public photometric redshift code (EAZY), and compare its accuracy to the spectroscopic redshift data provided by NASA (CANDELS) for 1338 astronomical objects.  We want to create modules to improve the photo z code by including the measurements with errors, to be as accurate as possible.  To do this, we have created modules such as probdist.py, perfdata.py, outfileplot.py, among MANY others.  My astrophysics mentor helped me with my work.  For more details, read summary of work below...  Summary of work Using public photometric redshift code EAZY to estimate redshifts: Modeling estimates for our systematic uncertainties on certain percentages of the flux:  when our uncertainties are estimated correctly we can expect the true spectroscopic value being within the one sigma range 68% of the time; and the two sigma range 95% of the time. I varied the three bands separately, one at a time, to isolate the effects of each. The bands are UV to optical, NIR, and IRAC. I ended up doing a total of 13 trials. I managed to get into the 68% region very well, but not as well for the 95% region, having reached a limit due to the outliers. After varying the three bands many times, it became evident that it no longer made a difference how much I would vary them, and I was not able to get past 89-91% in the 95% region in the best case. Of course, we isolated the effects of the outliers to get our best case (trial 11) as best as we could by not including them in the number of objects (total = 1338). We did this by setting up a new counter that would only count the objects that were not outliers. This reduced our count of not-outliers to 1232 in trial 11. Next, we used our best trial and set up the probability distribution of parameter redshift (pz) and the redshift as computed by the grid parameters (z). This will give us the probability distribution functions for the photo z, which we can use as SED fitting parameters.  Summary of Work Part 2 Next, we created a routine called probdist.py, which opens 'filename' (filename stands for all of the files in OUTPUT that end in .pz) for reading.  We write to our created file; candels.txt, which uses the z and pz values from filename. This will graph p(z) (the probability distribution of the parameter redshift for 1338 objects, or galaxies) vs the redshift. The candels.txt files should ideally match up to the .pz files, which graph the flux vs the wavelength. We check what the graph looks like by using gnu plot, and use only columns 1 and 4 for the .pz files (z and z_p).  We try to fit this redshift prob dist to a Gaussian, and we do this by finding the mean and standard deviation. For this, I created a module that will compute the average, called average.py. We found the average of the X values, which gives an estimate of the mean.  The routine stdev.py excludes those pz's that are less than .001 to give us better values, and this also reduces the amount of galaxies that we are using to the amount that have the desired pz value. We then proceed to use POPT, which optimizes our parameters and use a curve_fit function to fit to a gaussian. We assigned a, x0 and Sigma to POPT (a is normalization(amp), x0 is avg, sigma is stdev). These values are used in the Gaussian function, which utilizes the equation of a gaussian (and stdev.py calls upon this module to print popt, and provide us with the values of a, x0, and sigma). We then use these values in the equation of a gaussian in gnu plot.  Of course, all this information is also written in the file that we called 4colampavgstdev.txt, and can be looked up from there. It has an index, followed by the amplitude, avg, and stddev of each galaxy.  The curve fit did not work for every single galaxy. There was a degeneracy; or two possible solutions for galaxies 6, 11, 88, 566, 684, 991, and 1203. Galaxy six in particular had a negative amplitude, and Galaxy 11 and 566 had a negative average.  Lastly, I have worked with the golden galaxies; called Golden because they are the ones that have the best values (they have a signal to noise ratio of at least 8 (flux/error > 8) in at least 13 bands). 585 of the 1338 galaxies are part of the gold sample. For these galaxies, I copied the file of probability distributions to have the best possible pz's.