Python Forum
Help Understanding Portion of Code
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Understanding Portion of Code
#1
Hi everyone,

I'm very new to python and have been given some code to work with for a study I'll be conducting. There's just one section that I'm not quite understanding based on what I know about python so far. I've posted this section below.

What I'm not understanding is what's going on in the line below the note "initialize lists for hard coding...". Why would these lists be so long and written in this pattern if they're getting randomly shuffled?
The reason I want to understand this is that I want to figure out how to add a third soa time.

Thanks in advance for your help.

#define stimulus duration times 
fixscreen_time=.8
cue_time=.15
soa_short=.05
soa_long=.15

#initialise lists for hard coding side, soa and validity proportions 
#cueside - 0=left; 1=right; soa - 0=early; 1=late; validity - 0=valid; 1=invalid
cueside=[0,0,1,1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,1,
0,0,1,1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,1,
0,0,1,1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,1,
0,0,1,1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,1,
0,0,1,1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,1,
0,0,1,1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,1,
0,0,1,1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,1]
soa=[1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,
1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,
1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,
1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,
1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,
1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,
1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0]
validity=[0,1,1,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,
0,1,1,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,
0,1,1,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,
0,1,1,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,
0,1,1,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,
0,1,1,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,
0,1,1,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1]

#shuffle order of the trial factors
random.shuffle(cueside)
random.shuffle(soa)
random.shuffle(validity)
Reply


Messages In This Thread
Help Understanding Portion of Code - by caroline_d_124 - Jan-12-2019, 07:52 PM
RE: Help Understanding Portion of Code - by Larz60+ - Jan-12-2019, 07:54 PM
RE: Help Understanding Portion of Code - by buran - Jan-12-2019, 07:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Code understanding: Need help in understanding dictionary code jt123 0 476 Jul-09-2023, 01:13 PM
Last Post: jt123
  New to python/coding Need help on Understanding why this code isn't working. Thanks! mat3372 8 1,759 May-09-2023, 08:47 AM
Last Post: buran
  How to delete portion of file already processed? Mark17 13 2,766 Jan-22-2022, 09:24 AM
Last Post: Pedroski55
  Understanding a piece of code Michael1 4 1,420 Jan-20-2022, 07:14 PM
Last Post: Michael1
  Beginner: I need help understanding few lines of a code. hop_090 1 1,697 Sep-07-2020, 04:02 PM
Last Post: Larz60+
  Extracting Rows From Data Frame and Understanding The Code JoeDainton123 0 1,445 Aug-03-2020, 04:08 PM
Last Post: JoeDainton123
  code not writing to projNameVal portion of code. umkc1 1 1,683 Feb-05-2020, 10:05 PM
Last Post: Larz60+
  Help Understanding Code Variables 1 1,917 May-02-2019, 05:53 PM
Last Post: micseydel
  Need help understanding simple Array code. Please. stluwa 1 2,218 Apr-13-2019, 07:16 PM
Last Post: loomski
  Trouble Understanding Why This Code Works crocolicious 2 2,714 Apr-09-2019, 05:24 PM
Last Post: crocolicious

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020