Sunday 28 May 2017

Updating Mars 'Top Trumps' webpages

I have previously created a website for Souness Glacier Top Trumps, based on Colin Souness' work on candidate mid-latitude glaciers on Mars, and my MSc thesis on them.

One of the things covered is whether the object has coverage with the High Resolution Imaging Science Experiment on Mars Reconnaisance Orbiter.

The HiRISE team are continually releasing new images as the Mars Reconnaisance Orbiter is still operating.

I have some horribly obsfucated Python code that can match the shapefile coverage of the Souness objects, to coverage footprint shapefiles, after using QGIS to reproject to a common coordinate system.

I have recently updated my Top Trumps webpages to use shapefiles up to 4th May 2017.

However, the Mars Express tiles remain the same, since the data releases of High-Resolution Stereo Camera process to level 4 (including the derived digital terrain model) are available at NASA Planetary Data System only up to orbits up to 12th Feb 2009.

There do appear to be newer ones recently uploaded at the Freie Universität Berlin website, although they are not in the same format as the ones I used from NASA PDS and they are not in the European Space Agency Planetary Science Archive or NASA PDS yet.

The website currently says:

Archive status (highest released orbit): f836 (levels 2 & 3, PSA), 6567 (level 4, PSA), d795 (level 4 VICAR, HRSCview)

To incorporate these would require a more comprehensive reanalysis of the data, since some more Souness objects would gain digital terrain model coverage and some would gain improved resolution coverage.

An example Souness object which now has links to additional HiRISE footprints from the University of Arizona HiRISE webpage.
I also fix a bug whereby if HiRISE covered all of the bounding box of the 'context' of a Souness object, the png overlay for the HiRISE coverage would show only transparency, due to the way in which ImageMagick was used to colourise the rasterised shapefile.

The convert command was modified from
convert {i} +level-colors black,yellow {o}
to
convert {i} +level-colors ,yellow {o}

so that in the input file,  the value 255 is taken only as the white point, not as both black and white which produced a blank image containing only transparency.

e.g. Souness 83

Souness 83, where the bounding box is wholly covered by the footprint of the HiRISE image PSP_010345_2150.



Saturday 6 May 2017

Bilingual interface to Cornish Corpus Statistics Python GUI application and switching between Kemmyn and manuscript spelling

As part of my taklow-kernewek tools, I created an application that can do some corpus statistics on Cornish texts, and is configurable at run-time to a certain extent.

I have made a few improvements to the files cornish_corpus.py and corpus_wordfreqGUI.py, which include a bilingual interface, and ability to switch between using Kernewek Kemmyn and manuscript spelling (or at least a reading of such).

To create a switchable bilingual interface, I overhauled the GUI code to make it more object orientated, and created a set of dictionaries where the keys each refer to another dictionary with 2 elements {'en': 'English text', 'kw': 'Cornish text'}.

A button in the GUI then runs a function that changes the interface language, and alters the text in all of the relevant widgets to use that in the new language.

It can also be specified when running corpus_wordfreqGUI.py, at the command line as the -e switch which will launch with English interface.

English interface. The button at the lower left allows switching betweeen the two.

Cornish interface
I have also fixed a bug that happened when there were no words longer than the specified number of letters, and the list of word frequencies is generated. Internally, what happens inside cornish_corpus.py is that the length of the longest word is found, so that the output text is spaced appropriately. Now it checks whether there is an empty list of tuples of (word, frequency) to avoid an indexing error.

The other thing I have done is fix a bug when the manuscript spelling was selected (previously only via command line -m switch, but now also in the GUI, as below). There is a different list of texts available in manuscript vs. Kemmyn, which had previously caused the program to have an index error in some cases.

Unfortunately I still have an issue with TkInter, since when switching between Kemmyn <--> manuscript there is an extra empty space generated, which needs a bit of adjustment to how the widgets pack etc. I got a bit confused when trying to fix it so am leaving it in for now.
Kemmyn (top left) and manuscript (bottom right). These windows have been launched direct from the command line, with the manuscript one launched by "corpus_wordfreqGUI.py -m" to choose the manuscript spelling texts rather than Kemmyn.

Annoying issue with space at the left appearing after switching within the GUI to manuscript spelling.

Update 07/05/17 - Tkinter bug fixed

After spending a while looking at my copy of Programming Python I found the pack_forget() method, which I used to remove the buttons at the lower left (language and manuscript mode switch) while the text choice list is repopulated with new radio buttons, and then the buttons are repacked afterwards.
I also show in the heading above the list texts which mode the program is in.

In Kemmyn mode, showing the most frequent words of at least 5 letters in Passyon agan Arloedh

In manuscript spelling

Thursday 4 May 2017

Mathematics quiz in Cornish with some improvements

I have made some improvements to the mathematics quiz apposyans_awrgrymGUI.py in my taklow-kernewek tools.

There is now a facility to set a difficulty level, either easy where numbers are always 1-10 and negative answers are suppressed, medium allowing numbers up to 20 and hard allowing numbers up to 40.
The program asks what 10 + 32 is, the answer of course is 42.

The user has answered the question 19 - 33 incorrectly as -4. The program has repeated the previous question in text and figures along with its answer.

The report at the end shows how many questions were answered correctly, and what the points score was. I may well revise the way this calculated since at present it can reward speed more than accuracy (1 point is given for each correct answer and 10-t for speed where t is the number of seconds taken to answer, up to 10 seconds).




Wednesday 3 May 2017

Mathematics Quiz in Cornish

One of the things I discussed in my talk last year at the Skians conference as possible future developments in software for Cornish is tools or games for learners.

In a first step in that direction, I have programmed a mathematics quiz which asks twenty questions of addition or subtraction, in a Python Tkinter GUI app (or at the command line), to help users practice recognising Cornish numbers.

After entering a number in the box, click on "Profya Gorthyp" or press Enter to submit the answer.

The computer checks the answer for correctness, then shows the time taken for you to submit it, number correct out of questions answered so far, and the total points. One point is awarded for a correct answer, and extra points for speed.

After 16 questions answered, 14 were correctly answered, and total points is 75.4

The end of the quiz after 20 questions.
The code is at my taklow-kernewek repository at Bitbucket. I will likely add a little more to it, including perhaps some different difficulty levels, and maybe some multiplication or division at some point.