Skip to content

Instantly share code, notes, and snippets.

@KramKroc
Last active May 10, 2018 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KramKroc/66c698db3b7762503329be9e74afb6bc to your computer and use it in GitHub Desktop.
Save KramKroc/66c698db3b7762503329be9e74afb6bc to your computer and use it in GitHub Desktop.
Instructions on how to get Lux Quest results and run them in MineCraft

Fetching the results

We've stored our entire Astro-Pi project including the results up on Github so these steps will detail how to pull them down onto your Pi.

First, create a folder to work with the code:

mkdir results

Next, pull the code down from Github:

git clone https://github.com/coderdojo-banbridge/astro-pi.git

This will create a folder called astro-pi and you'll see it mirrors the structure of https://github.com/coderdojo-banbridge/astro-pi

Looking at the results

The results are stored under results/astro-pi/2018/LuxQuest/luxquestdata/3435_Lux Quest/61 and if you do a quick ls *.jpg | wc -l you'll see that 1860 images were captured.

There is also a Lux Quest_console.log which captured any output (print statements etc) from the program.

And finally there is the Lux Quest_results.csv file which recorded all of our results!

Let's take a look at one of those rows in the csv:

time lat long photo lux
2018-04-28-00-34-37 -44.8390546746369 -83.8707068565246 /home/pi/Transfer/3435_Lux Quest/61/2018-04-28-00-34-37LuxQuest.jpg 5.35385091145833

So, all the data we expected, i.e. when photo was taken, where it was taken (lat & long), the photo that was taken and finally the measure of brightness of the image.

If you take one more look at the the photo entry, you can see if has stored the photo in a different location, /home/pi/Transfer/3435_Lux Quest/61/2018-04-28-00-34-37LuxQuest.jpg to where we've pulled out code from github. We've a few options here:

  • Using LibreOffice, open the csv file and do a find and replace of /Transfer/ with /results/astro-pi/2018/LuxQuest/luxquestdata/
  • Copy your data from results/astro-pi/2018/LuxQuest/luxquestdata to Transfer
  • Or simply create a link from Transfer to results/astro-pi/2018/LuxQuest/luxquestdata

The last option is what you will get if you do the following:

cd /home/pi
ln -s ~/results/astro-pi/2018/LuxQuest/luxquestdata Transfer

We want to rename the results file from Lux Quest_results.csv to results.csv

mv /home/pi/Transfer/3435_Lux\ Quest/61/Lux Quest_results.csv /home/pi/Transfer/3435_Lux\ Quest/61/results.csv 

Then finally update the config.py in /home/pi/results/astro-pi/2018/LuxQuest to point to where the results.csv file is. You can use whatever your favourite python editor is for this and change the following line:

    resultsDirectory = '/home/pi/luxquestdata/'

to:

    resultsDirectory = '/home/pi/Transfer/3435_Lux Quest/61/'

Run and View results in Minecraft

Remember, you need to have Minecraft running, so start that first of all. Also, you need to have installed all the required packages and libraries too.

Then run our programme. We're going to assume we're in the right directory, e.g. /home/pi/results/astro-pi/2018/LuxQuest

python dataModeller.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment