Showing posts with label science. Show all posts
Showing posts with label science. Show all posts

Tuesday, 3 June 2014

Stellarium - Intro to basic scripting

I am a space nut. I love everything about space, from how weird and mysterious it is, to how vastly, hugely, mind-bogglingly big it is to Douglas Adams. It's difficult to explain at the best of times and something like a static powerpoint simply never does it justice. In my travels I have discovered quite a few programmes for exploring the universe, including the weighty Celestia, but my favourite in terms of ease of use is currently Stellarium. It's free and open source and a great way to get into exploring the sky in some detail. Also it comes with a scripting interface and a host of complex examples - so in this tut I'm going to describe the very basics of setting up and automating a Stellarium script.

Installation and Use

Download and install Stellarium here. Run the program and it will show you the stars from Paris for the current date. Have a play and get used to the controls (a full list is here), but some useful basics:
  • A - toggles the presence of the atmosphere
  • P - toggles the labels of the planets
  • Ctrl + Up/Down - zooms in and out
  • Space centres on the selected object
  • F12 - displays the command window (for scripting)
Expanding the bottom left corner pane reveals a spanner, select it and navigate across the the scripts tab to find all the loaded demo scripts. Finally, to edit or create new scripts you will find them in the Stellarium directory's 'scripts' folder and you should be able to edit them with any text editor (if you keep them here they will automatically appear in the scripts list).

Time and Place

The most confusing thing (for me!) about planetarium software is getting the time and place correct that you're looking to replicate. In Stellarium there are two commands for setting and getting time and position data:


These commands return the current time and location in Stellarium and set those as the current location. Nothing too magic here, but you can also pass the set commands any date or location and it will display what is visible from those coordinates.
i.e. These are the stars at 5am on the day I was born, as seen from Wellington, New Zealand:

Setting focus

Because of the aforementioned hugeness of space, it's inadvisable to to jetting off without knowing roughly where you want to go. For that reason, the easiest way to script is to select your target object, turn to face it and them move directly towards it. In Stellarium we can do that with the commands:


The second line of the above sets Stellarium to keep tracking the object as it moves through space. Then we can zoom in and out with:



with the core.wait(5) command setting the script to pause between commands, for 5 seconds (it's always a good idea to do this to allow the camera to complete one motion before starting another). We can direct the zoom to a specific scale with:


Challenge!

Generate a script that centres on and then zooms to the planets in order, then speeds up time to show the rotation of each planet, then finally zooms to our nearest star (Proxima Centauri) and looks back to see our sun from there.

As as per usual here's a full functional script that centres on the moon and then zooms to show Jupiter and the Galilean moons as an example.

Monday, 26 May 2014

New Wellington technology groups

After a manic few months in my new position at VUW, I've finaly got a few minutes to detail exactly what I've been up to and where I hope it's going to go in the future. this blog will serve to keep track of what I've been doing, as well as to act as a summary point for all the tutorials that I have written/will write.

For those that don't know me, my aim to to encourage students to pursue careers and studies in engineering science and mathematics. Half of my time for my current position at Victoria is spent visiting schools (I tend to focus my attention on high schools but I also do visit intermediate and primary schools as well) to this end, and the other half of my time is spent providing pastoral support for the Victoria University first year Engineering students specializing in physics, mathematics and general digital engineering.

Currently, in addition to my regular school visits, I run two local technology groups for high school students that meet weekly. <tek ctrl/> at the Lower Hutt Memorial library on Thursday afternoons from 3:30pm till about 5pm and DFSLIA (a girls-only technology group) that meets at the National Library in Thorndon from 3pm-5pm on Wednesday afternoons (with the assistance of the wonderful Kate Henderson). The purpose of these is for me to spend as much time as possible with interested students (I simply don't have enough time to visit all of the 40-odd high schools in the Wellington region regularly enough!) to work on interesting projects and encourage them to learn more and experiment with modern technologies.  Attendance is free and while the groups are aimed at Year 11-13 students (i.e. 16-18 year olds) interested younger students are also welcome to attend.

If you would like me to come and visit your school, don hesitate to get in touch with me via my Victoria University staff page (yes I can occasionally travel outside the Wellington region). If you're a teacher interested in Python professional development I also run small group (<4) Python PD sessions for NCEA DT levels 1,2, and 3.

I'm also trying to grow a high-school technology community base alongside the TechXperts from Wellington East Girls College, the first meeting of which will be held at Victoria University on Saturday the 14th June 2014 in AMLT102 from 11am-3pm.

What specific technology do we look at? For starters take a look at the tutorials page of this blog, but in general I'm happy to work with anything related to science, technology or mathematics. I tend to focus on python, android, blender, arduino and linux projects simply because students and schools are budget constrained and so free/cheap technologies mean more people can access them. I also work (a little) with VEX and Lego Mindstorm kits.