Week 4 (08/01-08/05)

Example Header:

Example Data Table:

Monday

Plotting Flux against Wavelength in Regions unaffected by spectral lines

  • Working in nb Continuum_Reduction_All.ipnyb and Continuum_Reduction_Ind.ipynb
  • After having extracted all the flux data for each star on Friday, looking to replot the data that is unaffected by spectral lines
  • estimated that at wavelengths 7.5 nm around a spectral line, the flux seems significantly altered → looking only to plot the points that are not within 7.5 nm around a spectral line.
    • my estimate of 7.5 nm was a guesstimate from original graph in project description around the H\alpha line, can be changed in the code
  • code became a little difficult to work with when trying to process all files, moved to work in individual file Coninuum_Reduction_Ind.ipynb
  • successfully created a mask that only keeps values outside of 7.5 nm range of spectral lines (extracted from the "Detected" column of HDU table in file
  • For some reason, getting a bug where np.masked_array is not properly masking the values:
  • First array is unmasked data
  • Second array is masked data that should be masked within 7.5 nm of spectral line wavelength
  • Third array is the mask
  • Just from the first three values of the arrays, we can see that the mask is not working (the first three values should not be masked but are), so I am a little bit stuck here. The data that is plotted is not what I am expecting, as there are large regions that should be plotted (Like at the 600nm lines), but are not.
  • Also plotted the wavelengths of the detected spectral lines from the primary data element to see that the desired plotted points do not fall around those lines (results not as expected)

08/02/2022 Tuesday

Machine Shop

  • Did the RED Machine Shop Training. It was so cool! Had Stan as my instructor, he is a very cool guy. Great humor.
  • Got lab safety goggles and reviewed lab rules with Stan.
  • We first learned how to use the horizontal bandsaw and cut PVC pipes
    • Important takeaways: make sure the red lever and the black lever are both vertical when no longer using the machine
    • The water-soluble oil was pretty cool too
  • Learned how to use the vertical bandsaw
    • Make sure hands are outside of the rectangle etched on the table when the blade is running
    • do not stop the blade when the blade is in the middle of the material – can clamp the metal piece out with wood and pull it out; relevant when cutting out smaller pieces
    • Cut steel pieces from the whole bar
    • Cut PVC Pipe, will need a metal clamp (question) to hold the pipe down and keep thumb on the drill part
  • Learned how to use the drill press
    • Did the pecking technique
    • clean up = use an air gun to get the metal off the surface of the machine
    • Drill components: Tip, flutes, shank
  • Learned how to cut sheet metal
    • Stomp
  • Cut the corners of the sheet metal, rounded the edges, smoothed them out with a sandpaper machine thing (question)
    • Used a file. Only move upwards or else Stan will be disappointed
    • Punched some holes in there, also pretty fun
    • Metal bent the sheet metal
  • Final product!

Plotting Flux against Wavelength in Regions unaffected by spectral lines

  • Working in Continuum_Reduction.ipynb
  • realized that the root of the plotting problem from yesterday was that the boolean values of the "mask" of a NumPy array are for whether the value should be masked (True) or not (False), not whether the value should be plotted. Fixed function that decides which values are masked
  • successfully plotted fluxes outside 7.5 nm of the required wavelengths (spectral lines vertically plotted → note: used "Tabulated" and not "Detected" wavelengths, confirm with stubbs that this is best move
  • For these plotted data points, grouped data into buckets of 5 nm, took an average of all fluxes that corresponded to wavelengths that all rounded to the same nearest multiple of five
  • I also designed the code so you can easily group the data into buckets of other sizes, ie. 10 nm
  • Plot with buckets of 5 nm
  • Smoother regions when we take bucket size to be 10nm
  • in process of reducing code accidentally deleted a line that told me to skip the faulty file "spec_data_2022062800320.fits" so will need to reimplement that line when running individual file function over all the fits files

Abstraction is the Best

  • Because a lot of my files have repeated code, I was looking into ways to access functions across notebooks, and I discovered %run filename which is the best thing ever (!!!!) to improve the style of my code
  • On Continuum_Reduction.ipynb, took functions out (that I know for sure are repeated across my other files) into file helper_functions.ipynb. Implemented many lines of code as single lines calling these helper functions. Reduced my code by a lot! Makes it easier to read, too. Happy about that. Probably will revisit other code tomorrow to simplify and reduce code
  • Also fixed a small bug that always kept me in the spectrum_data directory; now I move back in directory with all my code when I run the jupyter notebook.

scratch.ipynb

  • has a bunch of code that I no longer needed but could be useful in the future (displaying all elements of np array)

Qs for Stubbs:

  • use tabulated or detected data?

08/03/2022 Wednesday

Meeting with Stubbs

  • Met with Stubbs and Eske today, and the main focus is that we need to establish quality control.
  • The next steps involve using oxygen, chi-squared, grating, SNRs, and parangles to get a better feel for the data we have and which data points are invalid (more details in meeting notes)

Machine Shop

  • Went into the machine shop today to start GREEN training. Will be making the Lucy engine.
  • Worked on gathering the cut parts for the machine today based on the Project Cut List. Mostly just used the vertical bandsaw and the horizontal bandsaw to cut the pieces. Also learned how to use the handsaw to cut the smaller diameter pieces of metal.
  • Also used the cotton mill to smooth out the edges of the metal pieces.

Creating Spline Data

  • Using scipy.UnivariateSpline(w_avg,f_avg) to get make a spline graph for the data points; encountered some errors and realized I had an error in my previous algorithm that was supposed to catch masked values (so previously the buckets that I made ended up including masked values, which we do NOT want. Fixed it now)
  • Also read up a bit about spline interpolation, per Eske's rec during out meeting today
  • For some reason I am getting some weird outliers. Trying to figure out where they come from because otherwise I would have very nice spline fit:

  • We can see the two data points, the one at 405 nm and the one at 450 nm ish are causing problems... Don't know where they are coming from but attempting to find why they show up
  • Ah, something wrong with code; two values to each bucket; fixed, I assumed my list of data was sorted which was where the problem was



08/04/2022 Thursday

Machine Shop Training

  • Went into the machine shop this morning and afternoon, and managed to successfully create two parts as a part of the Lucy machine. Learned how to use the mill, pretty stressful experience, but overall fun. Accidentally placed the brass 0.25 mm radius rod too far out from the component that was holding it, and I accidentally broke the piece woops, will have to remake it. Trying to finish machine shop green training before I go home soon. Machine shop is taking longer than I expected

Replotting molecule eq_widths vs. airmass based on eq_width

  • Ok! The data from week 1 plotting molecule eq_widths vs. airmasses looks much better when we separate the two data points based on the different gratings. (I put the type of disperser in the title of the graphs, there were two types of gratings: ronchi vs. holo4)
  • Even though the data looks better, the range of airmasses is now smaller, could use some more data to plot against more airmasses
  • Working in Data-Clipping-Grating.ipynb

  • Unfortunately, the lack of points for each plots also means that there isn't enough data to calculate the covariance of the coefficients in the linear model OR that there isn't enough data to calculate the polynomial model y = a * x + b
  • Trying to get the r^2 values to show up for the linear model; some of them are actually quite good for some of the graphs shown above:

For instance, if we look at line 6, the r^2 is 0.85 which suggests a linear fit is quite strong for modeling the eq_widths of water against airmasses, however, this is not necessarily true for other models (see line 5 for example, r^2 is basically 0)

For the full table of the linear covariances and the polyfit can be found in this CSV file:  lin_poly_fits.csv

Will need to replot the graphs that attempt to show the independence of O2 and H alpha etc against airmass in Mol_Indenpendence.ipynb


Friday

Machine Shop

Went into machine shop today in the morning and afternoon, and got 2 parts finished and almost a third part that just needs to be threaded. Had some issues with drills (one of them broke). Learned how to thread today and use cutting oil 

Python Workshop

Eske held a python workshop on modules and libraries, which was quite helpful. Also got added to Stubbs lab group github. I think I will need to create modules to simplify my code (which is kind of what I was doing when running another python file before the other ones.




Copyright © 2024 The President and Fellows of Harvard College * Accessibility * Support * Request Access * Terms of Use