Genetic Algorithms using Python

Project: Looking for Dark Matter in the Rotation Curves of the Hubble Tuning Fork Galaxy Diagram

Department of Natural Sciences: Physics

Project adviser:  Dr. Scott Schneider

Researched by: Ceré L. Rettig


Project Summary as of: 10/21/2014


What is a galaxy rotation curve?

Galaxy rotation curves are a graphical analysis obtained from the magnitude of the orbital velocities of visible stars in a particular galaxy and their radial distance from the galaxies center, typically depicted with a scatter plot.

What is the Hubble Tuning Fork Galaxy Diagram?

The Hubble Tuning Fork Galaxy Diagram is a way to classify galaxies. Mr. Edwin Hubble believed that the elliptical galaxies (E0, E3, E5, E7) are early galaxies and that the lenticular (S0), and spiral galaxies (Sa, Sb, Sc, SBa, SBb, SBc) or late galaxies evolved from the elliptical galaxies. In this model the lenticular galaxies are viewed as a transition type between the elliptical and spiral galaxies. While this evolution model has been found to be incorrect, this is a good diagram used for galaxy classification.

What is dark matter?

Dark matter accounts for effects that appear to be the result of mass where such mass cannot be seen. It attracts or exerts a gravitational inward pull on the visible matter surrounding it.

Are we sure it is not dark energy?

Yes, because dark energy repels or pushes outward.

What is already known about spiral galaxy rotation curves?

Rotation curves are an essential tool for determining mass distribution in spiral galaxies, and provide fundamental information.

The existing programs that will be used were created by:

Dane Falberg is another student at Lawrence Technological University who is working on an astrophysics project advised by Dr. Scott Schneider. I will use his project to understand, and build my own genetic algorithm program using Java.

Project Objectives:

  • Research galaxy rotation curves for the six different types of spiral galaxies.
  • Investigate mathematical models for ordinary matter and dark matter to generate rotation curves.
  • Research genetic algorithms.
  • Study Dane Falberg’s programing with genetic algorithms. (Not exactly…)
  • Create the software, to fit galaxy rotation.
  • If time is available see if this process can be done with lenticular galaxies.


J.Q. Feng and C.F. Gallo, Res. Astron. Astrophys. 11 1429-1449, 1 (2011).

Charbonneau, Astrophys. J. Suppl. Ser. 101 309-334, 1 (1995)

Sofue and V. Rubin, Ann. Rev. Astron. Astrophys. 39 181-0015, 1(2000).

What I’ve been working on:

  • Researching galaxy rotation curves for spiral galaxies, including: mathematical models for ordinary matter and dark matter to generate rotation curves.  
  • Researching Vera Rubin and her work on galaxy rotation curves.

Why Vera Rubin?

Vera Rubin’s work on galaxy rotation curves is why it is possible for my project to exist today. The discovery of her work was presented to both myself and Dr. Scott in the series finale of COSMOS: A Spacetime Odyssey with Neil deGrasse Tyson.

“We have peered into a new world and have seen that it is more mysterious and more complex than we had imagined. Still more mysteries of the universe remain hidden. Their discovery awaits the adventurous scientists of the future.  I like it this way.”

Genetic Algorithm (GA) Software

I will not be using Dane Falberg’s programming with genetic algorithms, it is too complicated. Dane Falberg was using a tutorial from the Project Spot. While I may not being learning from this code, I’d like to take the time to re-state some of key points from this website.

What does the Project Spot tell us about GA’s?

  • It’s great for finding solutions to complex search problems. Isn’t that fantastic, because using data points to match up galaxy rotation curves is definitely a complex search problem. Without the use of a genetic algorithm it can be quite a lengthy process.
  • They are based on the process of evolution by natural selection which has been observed in nature. This process they are talking about is quite lengthy to discuss in a short bullet point but it will be discussed further later on.
  • As previously stated, they can be used to find solutions to complex problems, and are relatively simple to use and understand. The fact they are simple, is good for someone like myself who does not have a lot of programming experience, but would like to use them to further their research.

In this next section I may use exact phrases from the Project Spot, as they are simplistically stated, so I am going to apologize in advance to the Project Spot and its creator Lee Jacobson of Bristol, UK. I would also like to thank the Project Spot and Lee for all the work put into sharing his knowledge of genetic algorithms.

  • Initialization – creates a randomly generated initial population and can be any desired size.
  • Evaluation – Each member of the initial population is then evaluated and a ‘fitness’ is calculated for that individual in the initial population.
  • Fitness – This fitness is calculated by how well it fits with our desired requirements.
  • Selection – Since we want to constantly improve our population’s overall fitness, selection helps us to do this by discarding the bad designs and only keeping the best individuals in the population. We want to make it more likely that individuals with the best fitness will be selected for the next generation.
  • Crossover – A crossover is done to create new individuals by combining aspects of our selected individuals. It can be thought of as simulating how sex works in nature.  The hope is by combining certain traits from two or more individuals we will create an even ‘fitter’ offspring which will inherit the best traits from each of its parents.
  • Mutation – This creates a little bit of randomness into out populations’ genetics otherwise every combination of solutions we can create would be in our initial population. Mutation *typically* works by making very small changes at random to an individual’s genome.
  • Now repeat starting from the evaluation step with our new generation until we reach a termination condition.

In my previous post I stated we would either obtain or create a genetic algorithm program using Python. I chose to obtain working code created by another individual from GitHubGist and created my own for galaxy rotation.


Again, Why Python?  Dr. Scott felt it was a good language to work with. I’ve also heard it is widely used and simple to learn for someone not familiar with programing. How was this decided? Well, one of the sources for the P. Charbonneau (1995) article, Genetic Algorithms + Data Structures = Evolution Programs which has a much more simplistic way of using genetic algorithms.

Am I effectively working through my project objectives?

Yes, I would like to use the scientific writing style outlined in my Introduction to Senior Projects in Science course, to improve upon my scientific writing skills.

%d bloggers like this: