Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8502011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:22:07+00:00 2026-06-11T01:22:07+00:00

Firstly, here is the relevant part of the code: stokes_list = np.zeros(shape=(numrows,1024)) # ‘numrows’

  • 0

Firstly, here is the relevant part of the code:

stokes_list = np.zeros(shape=(numrows,1024)) # 'numrows' defined earlier
for i in range(numrows):
    epoch_name = y['filename'][i] # 'y' is an array from earlier
    os.system('pdv -t {0} > temp.txt '.format(epoch_name)) # 'pdv' is a command from another piece of software - here I copy the output into a temporary file
    stokes_line = np.genfromtxt('temp.txt', usecols=3, dtype=[('stokesI','float')], skip_header=1)
    stokes_list = np.vstack((stokes_line,stokes_line))

So, basically, every time the code loops around, stokes_line pulls one of the columns (4th one) from the file temp.txt, and I want it to add a line to stokes_list each time.

For example, if the first stokes_line is

1.1 2.2 3.3  

and the second is

4.4 5.5 6.6  

then stokes_list will be

1.1 2.2 3.3  
4.4 5.5 6.6  

and will keep growing…

It’s not working at the moment, because I think that the line:

stokes_list = np.vstack((stokes_line,stokes_line))

is not correct. It’s only stacking 2 lists – which makes sense as I only have 2 arguments. I basically would like to know how I keep stacking again and again.

Any help would be very gratefully received!
If it is needed, here is an example of the format of the temp.txt file:

File: t091110_065921.SFTC Src: J1903+0925 Nsub: 1 Nch: 1 Npol: 4 Nbin: 1024 RMS: 0.00118753  
0 0 0 0.00148099 -0.00143755 0.000931365 -0.00296775  
0 0 1 0.000647476 -0.000896698 0.000171287 0.00218597  
0 0 2 0.000704697 -0.00052846 -0.000603842 -0.000868739  
0 0 3 0.000773361 -0.00234724 -0.0004112 0.00358033  
0 0 4 0.00101559 -0.000691062 0.000196023 -0.000163109  
0 0 5 -0.000220367 -0.000944024 0.000181002 -0.00268215  
0 0 6 0.000311783 0.00191545 -0.00143816 -0.00213856  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:22:09+00:00Added an answer on June 11, 2026 at 1:22 am

    vstacking again and again is not good, because it copies the whole arrays.

    Create a normal Python list, .append to it and then pass it whole to np.vstack to create a new array once.

    stokes_list = []
    for i in xrange(numrows):
        ...
        stokes_line = ...
        stokes_list.append(stokes_line)
    
    big_stokes = np.vstack(stokes_list)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So firstly here is the relevant table structure: TUBE_VIDEOS ------ id video_name TAGS ----
Firstly, thanks for your help. Here's my situation: I'm trying to edit the code
firstly, here's my code SELECT dbo.tblPat.pID, dbo.tblRec.rID, right(rPCheck, LEN(rPCheck) - (CHARINDEX('|', rPCheck))) as pCheck,
Firstly, here is my code: Ext.Msg.show({ title: 'Username', msg: 'Please enter your username', buttons:
Firstly here is the code that im trying to get to work- private: System::Void
Firstly here is my PHP CODE if(!isset($_POST['selection'])){ $missing['selection'] = $required['selection']; } if(empty($missing)) { post2session();
Firstly here is my ruby and rails version with a couple of the important
Firstly, here's my script: #!/usr/bin/python import sys, os sys.path.append('/home/username/python') sys.path.append(/home/username/python/flup) sys.path.append(/home/username/python/django) # more path
Firstly, the bash script works fine when I call it outside of ant. Here
Background: Firstly, I'm unsure if this is even called a metabox Here's an example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.