Loading...
Error
There was an error loading the page.
Taxonomy:
History
Christian Lawson-Perfect 1 year, 7 months ago
Published this.George Stagg commented 2 years, 10 months ago
SVG output now works. I've compiled the svglite package for webR and set things up so it can be loaded into the filesystem.
I tried to make it work nicely by adding a r_load_package(pkg_name) function that takes a package name and loads it, ready to be used with R's library() function, and add it to the pre_submit note so that it loads the package before the student's code runs. However, there's an issue where unless the webR runner is already loaded and ready to go the image doesn't appear until the second time the part is submitted.
When it happens the output svg doesn't exist in the virtual filesystem at all, so I think there's an issue with my promises that are supposed to resolve only once the WASM libraries are finished compiling. I've worked around it for now by loading the package in the question preamble.
George Stagg 2 years, 10 months ago
Saved a checkpoint:
Tweaked for newest version of the runner and SVG file output.
George Stagg commented 2 years, 10 months ago
That's awesome, thanks! Pyodide gives access to the same Emscripten filesystem API that I'm using for webR here, via pyodide.FS. So, later if we like this method we should be able to extend it to do the same thing there.
Christian Lawson-Perfect commented 2 years, 10 months ago
I've written a generic r_load_files function to load a list of files out of the webR environment. For pdfs it returns a blob URL; for everything else it returns the contents of the file as a string. This is a promise, so you can use it as a pre-submit task; it fills in the entry 'r_files' in the pre_submit note.
I made the feedback() marking function take HTML, so you can display the plot in the feedback without any magic.
The blob URLs won't work in suspend data. We need a reliable way of serializing file binary contents to strings. base64 encoding is the only thing i can think of at the moment.
The load_files function should be built in to the extension, and work for whatever language runner.
George Stagg 2 years, 10 months ago
Created this.Name | Status | Author | Last Modified | |
---|---|---|---|---|
Make a plot | draft | George Stagg | 13/09/2024 11:05 | |
Make a plot with matplotlib | draft | Christian Lawson-Perfect | 10/05/2023 13:31 | |
Make a plot with matplotlib | Ready to use | Christian Lawson-Perfect | 23/11/2023 11:37 | |
Make a plot | Ready to use | Christian Lawson-Perfect | 24/07/2024 10:28 | |
Plotting a parametric surface with Python | draft | Toby Wood | 03/04/2024 14:59 |
There are 21 other versions that do you not have access to.
Name | Type | Generated Value |
---|
|
Error in variable testing condition
There's an error in the variable testing condition. Variable values can't be generated until it's fixed.
No variables have been defined in this question.
Generated value:
- :
This variable doesn't seem to be used anywhere.
No parts have been defined in this question.
Select a part to edit.
This gap is not used in the parent part's prompt.
The student will not be able to enter an answer to this gap.
Ask the student a question, and give any hints about how they should answer this part.
Pattern restriction
Variables
String restrictions
For each combination of answer and choice, specify the number of marks to add or subtract when the student picks it.
For each combination of answer and choice, write 1 if the student should tick it, or 0 if they should leave it unticked.
Test that the marking algorithm works
Check that the marking algorithm works with different sets of variables and student answers using the interface below.
Create unit tests to save expected results and to document how the algorithm should work.
There's an error which means the marking algorithm can't run:
This is an extension type part. There is no expected answer, and it's assumed that the marking depends on interactions within the part's prompt.
You can test this part's marking algorithm by interacting with the rendering of the part's prompt below.
Feedback
Score:
Question variables
These variables are available within the marking algorithm.
Name | Value | |
---|---|---|
Marking parameters
These values are available as extra variables in the marking algorithm.
Name | Value |
---|---|
Part settings
These values are available as entries in the settings
variable.
Name | Value |
---|---|
This feedback is based on your last submitted answer. Submit your changed answer to get updated feedback.
Warnings:
Alternative used:
These are the notes produced by this part's marking algorithm.
Note | Value | Feedback |
---|---|---|
|
||
|
Click on a note's name to show or hide it.
Unit tests
No unit tests have been defined. Enter an answer above, select one or more notes, and click the "Create a unit test" button.
The following tests check that the question is behaving as desired.
This test has not been run yet This test produces the expected output This test does not produce the expected output
This test is not currently producing the expected result. Fix the marking algorithm to produce the expected results detailed below or, if this test is out of date, update the test to accept the current values.
One or more notes in this test are no longer defined. If these notes are no longer needed, you should delete this test.
Name | Value |
---|---|
Note | Value | Feedback | |||
---|---|---|---|---|---|
This note produces the expected output | Current: |
|
|||
Expected: |
A difference in feedback messages does not cause this test to fail. A difference in warnings does not cause this test to fail. |
This test has not yet been run.
When you need to change the way this part works beyond the available options, you can write JavaScript code to be executed at the times described below.
To account for errors made by the student in earlier calculations, replace question variables with answers to earlier parts.
In order to create a variable replacement, you must define at least one variable and one other part.
Variable | Answer to use | Must be answered? | |
---|---|---|---|
The variable replacements you've chosen will cause the following variables to be regenerated each time the student submits an answer to this part:
These variables have some random elements, which means they're not guaranteed to have the same value each time the student submits an answer. You should define new variables to store the random elements, so that they remain the same each time this part is marked.
This part can't be reached by the student.
Add a "next part" reference to this part from another part.
None of the parts which can lead to this part are reachable either.
Next part options
Define the list of parts that the student can visit after this one.
Previous parts
This part can follow on from:
This part doesn't follow on from any others.
to
Choose a type for this new .
by | More information |
Select extensions to use in this question.
-
There was an error loading this extension.
Define rulesets for simplification and display of mathematical expressions.
Built-in constants
Custom constants
Names | Value | LaTeX | |
---|---|---|---|
Add styling to the question's display and write a script to run when the question is created.
Use this tab to check that this question works as expected.
There was an error which means the tests can't run:
Part | Test | Passed? |
---|---|---|
Hasn't run yet
Running
Passed
Failed
|
This question is used in the following exam: