iOS cache issue

I"m currently experiencing an issue with the MWorks app on my iPad not properly updating the stimuli cache to reflect changes made to the stimulus folder on your laptop. This results in stimuli that I didn’t include in my stimulus folder being presented and, in some cases, stimuli that do exist in the folder are never presented throughout the experiment. I have the stimulus path set locally in the mwel file as, say, ‘Users/Documents/Stimuli/*.png’, for example. But when loading images the console reports that the images are being retrieved from ‘/private/var/mobile/Containers/Data/Application/EF62A3E4-FC15-4B89-A62B-43CAAAD856D5/tmp/MWorks/Experiment Cache/_Users_Documents_Stimuli’. Whatever that Experiment Cache folder is does not update as a result of changes in the original Stimuli folder. The only way to bypass this seems to be to create a new version of the task each time I add/remove stimuli from the folder. Is there a way to address this issue so the task can be updated dynamically instead?

One thing I also ran into when coding up the experiment is that some versions of the task only find the stimuli if I assign ‘filenames(…/Stimuli/.png)', but other versions only work with 'filenames(./Stimuli/.png)’. The error message is: “ERROR: Experiment packaging failed: No matches for list replicator FILENAMES() expression: ./Stimuli/*.png” and I think it is related to the same cached tmp folder issue between the computer and the ipad.

Thanks in advance!

Hi,

Issues like this typically happen when the experiment uses paths that contain .. (i.e. reference to the parent directory). MWorks expects all the files needed by an experiment to either be in the same directory as the main experiment file or in a subdirectory thereof. This is dumb, and we should do better, but for the moment, it’s just how things are.

If you’re using paths with .. to locate your stimulus files, I suggest instead adding symbolic links in the directory with your experiment file that point to the desired directories. For example, if your directory structure looks like this:

experiment/exp.mwel
images/img1.png
images/img2.png

add a symbolic link in the experiment directory that points to ../images:

$ cd experiment
$ ln -s ../images 

Then, when defining an image stimulus, instead of doing this:

image_file img1 (
    path = '../images/img1.png'
    ...

do this:

image_file img1 (
    path = 'images/img1.png'
    ...

That should resolve the issue with the iPad-side experiment cache not being updated properly.

That said, absolute paths should already work correctly, so if you’re locating your stimuli with paths that start with /Users/Documents/Stimuli/, I’m not sure what’s going wrong. Maybe you can send me a copy of your MWEL file, so I can take a look?

Thanks,
Chris Stawarz

Hi Chris,

Thanks so much for getting back to me. I’ve attached the mwel file because I could get the path modifications to work. Maybe there’s something I’m missing, but even when using the absolute path and still get this error:

"00:02:13: ERROR: No matches for list replicator FILENAMES() expression: /Users/carlarodriguez/Documents/MonkeyTurk/stimuli/allRF/RF4/*.png
Extended information:
parser_context: mw_list_replicator

00:02:13: ERROR: Failed to parse experiment /private/var/mobile/Containers/Data/Application/EF62A3E4-FC15-4B89-A62B-43CAAAD856D5/tmp/MWorks/Experiment Cache/_Users_carlarodriguez_Documents_MonkeyTurk_Tasks_rfGrid_iPadVersion_RF4.mwel/tmp/_Users_carlarodriguez_Documents_MonkeyTurk_Tasks_rfGrid_iPadVersion_RF4.mwel.xml”

Thanks in advance!

~Charlie

rfGrid_iPadVersion_RF4.mwel (23.1 KB)

Hi Charlie,

Thanks for sending your experiment.

It turns out that filenames never finds absolute paths in the server-side experiment cache. It only works with absolute paths if said paths are valid on both the client and server machines (as they are by default when MWServer and MWClient are running on the same machine). Since that can never be the case when the server machine is an iPad, you aren’t going to be able use both filenames and absolute paths in your experiment

I’ve opened an issue, so we can hopefully fix this (as well as the problem with ..) in the future. In the meantime, you’re going to have to switch to using relative paths. Probably the easiest thing would be to create a symbolic link to /Users/carlarodriguez/Documents/MonkeyTurk/stimuli in the directory containing your experiment file, and then use e.g. filenames(stimuli/allRF/RF4/*.png) when defining your stimuli.

Cheers,
Chris

Hi Chris, I ran into a similar problem when trying to run the iPad set up from a different machine. Everything else is the same as it was set up on the original machine (except the paths in the MWEL, of course). Now I can’t even load the experiments that had been previously working. The error I’m getting is along the same lines as the original issue with the cache. When I try to load the example experiment attached below, I get the following error:

“ERROR: Failed to create object.
Extended information:
reason: Path does not exist: /private/var/mobile/Containers/Data/Application/EF62A3E4-FC15-4B89-A62B-43CAAAD856D5/tmp/MWorks/Experiment Cache/_Users_vnl_Documents_MonkeyTurk_Tasks_grating_2AFC_240411.mwel/tmp/…/sounds/reward.wav
location: line 7, column 1
object_type: sound/audio_file
ref_id: idp8528874632
component: correct_sound
parser_context: mw_create”

I tried it the way I had been originally by using direct paths or the ‘…’, and also tried to implement your suggestion on the symbolic links. Got the same error either way. I’m wondering if it’s got to do with the contents in the iOS cache linked to my other machine. Any thoughts?

Thanks in advance!

~Charlie
grating_2AFC_240411.mwel (15.7 KB)

Hi Charlie,

If I create a symbolic link to /Library/Application Support/MWorks/Examples/RSVPDemo/sounds next to your experiment file:

$ ln -s /Library/Application\ Support/MWorks/Examples/RSVPDemo/sounds
$ ls
grating_2AFC_240411.mwel  sounds@
$ ls sounds/
acquire.wav   complete.wav  failure.wav   reward.wav    stm_on.wav

then I can load the experiment on my iPad without issue. If this is failing for you, my best guess is that you linked to a “sounds” directory that doesn’t actually exist or doesn’t contain the sound files you need.

I tried it the way I had been originally by using direct paths or the ‘…’

In case it wasn’t clear, the ... in the error message is just an abbreviation of the full path. It’s not related to the path component ...

Cheers,
Chris

Also, I hope it was clear that the commands preceded by $ are meant to be entered on the shell command line in the Terminal application. I noticed you included some in your MWEL file. I assumed they were just there for reference, as the experiment certainly won’t load with them present. I removed them before loading your experiment.

Chris

Hi Chris, thanks for getting back to me.

Re: symbolic links – yes, they were included for reference in the mwel file. Sorry for the confusion.

So far, I’ve established functioning symbolic links within the folder where I save the experiment and tried the approach you suggested above to work around the issue with filenames. However, I’m still running into the same issues.

I’m attaching 2 test files. The first one is just supposed to load the .wav files for correct/incorrect trials. This one fails and yields the following error:

" 00:41:24: ERROR: Failed to create object.

Extended information:

reason: Path does not exist: /private/var/mobile/Containers/Data/Application/EF62A3E4-FC15-4B89-A62B-43CAAAD856D5/tmp/MWorks/Experiment Cache/_Users_vnl_Documents_MonkeyTurk_Tasks_loadSounds_test_240415.mwel/tmp/sounds/reward.wav

location: line 7, column 1

object_type: sound/audio_file

ref_id: idp8557054984

component: correct_sound

parser_context: mw_create

00:41:24: ERROR: Failed to parse experiment /private/var/mobile/Containers/Data/Application/EF62A3E4-FC15-4B89-A62B-43CAAAD856D5/tmp/MWorks/Experiment Cache/_Users_vnl_Documents_MonkeyTurk_Tasks_loadSounds_test_240415.mwel/tmp/_Users_vnl_Documents_MonkeyTurk_Tasks_loadSounds_test_240415.mwel.xml"

In the second test file, I added a stimulus to test loading both sounds and stimuli. In this version, I don’t run into the sound file issue as above, but instead I get the following error when trying to locate the stimuli.

" 00:47:41: ERROR: No matches for list replicator FILENAMES() expression: stimuli/objects/Apple_1/*.png

Extended information:

parser_context: mw_list_replicator

00:47:41: ERROR: Failed to parse experiment /private/var/mobile/Containers/Data/Application/EF62A3E4-FC15-4B89-A62B-43CAAAD856D5/tmp/MWorks/Experiment Cache/_Users_vnl_Documents_MonkeyTurk_Tasks_loadSoundsAndStimuli_test_240415.mwel/tmp/_Users_vnl_Documents_MonkeyTurk_Tasks_loadSoundsAndStimuli_test_240415.mwel.xml"

loadSoundsAndStimuli_test_240415.mwel (946 Bytes)
loadSounds_test_240415.mwel (265 Bytes)

Thank you again and in advance for your help with this :slight_smile:

Hi Charlie,

Another thought: Is the version of MWorks running on your iPad the same as the version on the Mac from which you’re loading the experiment? These always need to be the same. In particular, if you’re using a 0.13.dev version on the Mac and any released version on the iPad, then you’re going to get errors exactly like this, because the method MWorks uses for sending media files changed in the 0.13 development cycle.

Chris

You’re totally right! That was precisely the issue. The new machine I was transferring to was running 0.13.dev.

The symbolic links definitely helped with the original cache issue, though.

Thanks, Chris!