Skip to content

Code for the G-CLEF Fiber Research Laboratory at the Harvard-Smithsonian Center for Astrophysics

Notifications You must be signed in to change notification settings

mattleung10/G-CLEF_Fiber_Lab

Repository files navigation

G-CLEF Fiber Lab

This repository contains code for the G-CLEF Fiber Research Laboratory at the Center for Astrophysics | Harvard & Smithsonian (CfA).

Introduction

During the 2021-2022 school year, I completed a co-op/gap year research internship at the Center for Astrophysics | Harvard & Smithsonian (CfA), where I worked on G-CLEF (GMT-Consortium Large Earth Finder), a precision radial velocity (RV) echelle spectrograph which will be the first light instrument for the Giant Magellan Telescope (GMT). G-CLEF will search for and characterize Earth-like exoplanets.

The project I worked on within G-CLEF was a prototype optical fiber mode scrambler which agitates the fibers feeding the spectrograph from the GMT, in order to mitigate a phenomenon called modal noise which is detrimental to exoplanet detection. There are two parts to this project:

  1. Designing and building a Fiber Characterization Station (FCS) which is used to determine certain metrics of optical fibers
  2. Designing and building the optical fiber mode scrambler and then testing it using the FCS

Click here to read a report which explains my work in designing and building the FCS and mode scrambler.

Fiber Characterization Station (FCS)

Design

The FCS allows for light to be injected into a test fiber, which is agitated by the mode scrambler. The FCS has four goals, which are to:

  1. Image fiber input face (to ensure proper light injection location and alignment)
  2. Image fiber near field (fiber output face)
  3. Image fiber far field (collimated output of fiber)
  4. Measure fiber output power and fiber focal ratio degradation (FRD)

The FCS design consists of four arms:

  1. Pre-injection arm, to inject light into the fiber
  2. Injection imaging arm, to image the fiber input face
  3. Near field arm, to image the fiber near field
  4. Far field arm, to image the fiber far field

Camera Control Software

Three cameras are used in the FCS. A Pixelink PL-B781U CMOS camera is used for the injection imaging arm, and two Matrix Vision mvBlueCOUGAR-X102kG CMOS cameras are used for the near field arm and far field arm. Custom camera control code was written to control the cameras. The Pixelink camera is controlled using the script pixelink_class.py (in the Pixelink_Interface directory), which is a class which wraps the routines in the pixelinkWrapper Python library. The Matrix Vision cameras are controlled using the mvIMPACT Python library (using the mvIMPACT Acquire Python SDK) and Harvester Python library. For more details, see the README.txt file inside the Matrix_Vision_Interface directory. Note that the Matrix Vision cameras acquire images in 12 bit, but the final images are saved as 16 bit files.

Custom GUI tools were developed to help with the optical alignment progress:

  1. GUI for aligning the injection imaging arm (pixelink_class_gaussian_fit.py in the Pixelink_Interface directory)
  2. GUI for aligning the near field arm (mv_harvester_class_gaussian_fit_crop_GUI_pyqtgraph.py in the Matrix_Vision_Interface/Using_Harvester directory)
  3. GUI for aligning the far field arm (mv_harvester_class_ellipse_fit_pyqtgraph.py in the Matrix_Vision_Interface/Using_Harvester directory)

The latter two GUIs were created using the PyQtGraph Python library, and are shown below.

Note that due to repository size constraints, images taken by the cameras were not included in this repository.

Optical Fiber Mode Scrambler

Background Information about Modal Noise

When coherent light propagates through a multi-mode optical fiber, the modes interfere at the fiber exit boundary, producing a high contrast speckle interference pattern called modal noise. This non-uniform interference pattern is a problem which particularly affects fiber-fed precision RV spectrographs like G-CLEF, leading to systematic errors and lower signal-to-noise ratios in measurements. To mitigate the effects of modal noise, a device called an optical fiber mode scrambler can be used. A mode scrambler dynamically agitates a fiber, so that the interference pattern will change over time and be smoothed out over long exposures, destroying the modal information in the fiber.

Most fiber mode scramblers mechanically agitate the fiber in order to mitigate modal noise. However, the generality of mode scramblers in the literature are limited, because they are often specific to a given instrument. Different mode scramblers in the literature mechanically agitate a fiber in different ways, for example by shaking, bending, rotating, or twisting. However, there has not been much research into the best way to agitate a fiber so that the highest amount of modal noise is reduced in astronomical applications. My internship project aimed to investigate this.

Mode Scrambler Design

In this project, the mechanical design of the mode scrambler prototype consists of a four-bar linkage crank-rocker. Two stepper motors are used, which are controlled by an Arduino (see the Arduino_Code directory). An electrical schematic is shown below. For more details, please see the report linked in the Introduction.

Analysis Code and Mode Scrambler Testing

Custom software was written to analyze the images taken by the cameras described above, when the mode scrambler was on and off. To test the mode scrambler, images of the fiber near field were analyzed, and the signal-to-noise ratio (SNR) of the pixels inside the fiber boundary was used as a metric for mode scrambling (for more details, please see the report linked in the Introduction). Various experiments were conducted, in which a particular parameter was varied (e.g. mode scrambler motor frequency) and its effect on SNR was investigated.

Images of the near field are considered as "science frames". In addition to these, calibration frames were also taken (dark frames, bias frames, and flat-field frames). After obtaining a corrected/calibrated image (dark and bias subtracted, and flat field corrected), the main goal is to identify the boundary of the test fiber's face in the corrected image. Then SNR and other metrics can be computed from the pixels inside the fiber face boundary. The process for identifying the boundary of the fiber face is non-trivial, because the mode scrambler was tested on fibers of different shapes (e.g. circular, square, octagonal, rectangular). To find the boundary of a fiber with a general shape, the alpha shape was found. The process is summarized below:

  1. Apply Canny edge detector to an 8 bit version of the corrected image, and obtain a binary image which represents the Canny edges. Let S be the set of nonzero points in the binary image.
  2. Compute the Delaunay Triangulation of S, called DT(S). Using DT(S), find the alpha complex Cα(S).
  3. Find the boundary of the alpha shape, which is the boundary of Cα(S).
  4. In some cases, the alpha shape can have an inner and an outer boundary. Take the outer boundary to be the boundary of the fiber face.
  5. If desired, offset the boundary.

The code to do all of this can be found in the Near_Field_Analysis directory. The script alpha_shape_id_roi.py contains functions to do the above five steps. alpha_shape_analysis_darks_flats.py does bias, dark, and flat-field correction on images in a certain subdirectory, and then calls hull_mask_from_alpha_shape in alpha_shape_id_roi.py on all the corrected images. For more details, consult the README.txt file in the Near_Field_Analysis directory.

The final prototype mode scrambler was able to reduce modal noise by a factor of ~8. Near field images of an octagonal and rectangular test fiber are shown below. Turning on the mode scrambler clearly reduces the modal noise.

Repository Directories

The following list explains what is inside each directory of this repository. All code was written in Python 3 (for the specific Python version, see the README.txt file inside each directory), with the exception of the code in the Arduino_Code directory, which contains Arduino sketches.

  • Arduino_Code contains Arduino sketches to control the motors in the mode scrambler prototype.
  • Gaussian_Fit contains code to fit a 2D Gaussian to an image. The code in this directory is used by scripts in other directories to focus the cameras.
  • Matrix_Vision_Interface contains code to interface with the Matrix Vision mvBlueCOUGAR-X102kG cameras, which are used for the near field and far field arms. Use the code in this directory to focus the cameras, and to acquire data for the mode scrambler experiments.
  • Near_Field_Analysis contains code to analyze near field images of fibers. This code is used to determine the boundary of the fiber face in each image, and some image metrics are computed from this.
  • Pixelink_Interface contains code to interface with the Pixelink camera used in the injection arm. Use this code to focus the camera.
  • Other contains miscellaneous code, mostly for testing/exploratory purposes.
  • Summary contains a report summarizing my work in this internship, and some images for this README file.

Specific requirements can be found in TXT files inside each directory.

Acknowledgements

I am very grateful to the G-CLEF team at the CfA for their invaluable help and support throughout this project, and for making this internship possible.

About

Code for the G-CLEF Fiber Research Laboratory at the Harvard-Smithsonian Center for Astrophysics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published