I have a long list of floats (1613808 elements long). It takes quite a
while to load this into a 7 dimensional Numeric array.
Is there any obvious way to speed this up?
def insertData(self,data):
# Start off with an array of the desired size
# "self.MEASURED", etc., are integers
arrayData = zeros([self.MEASURED, self.SWEPT, \
self.TEMPS,self.DCS, self.IVS, self.UUTS, \
self.DUTS], Float64)
i = 0
for device in range(self.DUTS):
for unit in range(self.UUTS):
for iv in range(self.IVS):
for dc in range(self.DCS):
for temp in range(self.TEMPS):
for swept in range(self.SWEPT):
for measured in range(self.MEASURED):
arrayData[measured][swept][temp][dc][iv][unit][device] = bigList[i]
i += 1
return arrayData
Stephen 3 1778
Stephen Boulet wrote: I have a long list of floats (1613808 elements long). It takes quite a while to load this into a 7 dimensional Numeric array.
Is there any obvious way to speed this up?
Perhaps reshape will be able to solve this problem for you. I hear it
is very fast.
- Josiah
"Stephen Boulet" <stephendotboulet@motorola_._com> wrote in message
news:bv**********@newshost.mot.com... I have a long list of floats (1613808 elements long). It takes quite a while to load this into a 7 dimensional Numeric array.
Is there any obvious way to speed this up?
def insertData(self,data):
# Start off with an array of the desired size # "self.MEASURED", etc., are integers arrayData = zeros([self.MEASURED, self.SWEPT, \ self.TEMPS,self.DCS, self.IVS, self.UUTS, \ self.DUTS], Float64)
i = 0
for device in range(self.DUTS): for unit in range(self.UUTS): for iv in range(self.IVS): for dc in range(self.DCS): for temp in range(self.TEMPS): for swept in range(self.SWEPT): for measured in range(self.MEASURED):
arrayData[measured][swept][temp][dc][iv][unit][device] = bigList[i] i += 1 return arrayData
Stephen
Creating a 1-dimensional array, then reshaping it is (I guess) as quick as
anything. Something like, import Numeric an_array = Numeric.array(range(24)) shape = [2, 3, 4] an_array = Numeric.reshape(an_array, shape) an_array
array([[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]],
[[12, 13, 14, 15],
[16, 17, 18, 19],
[20, 21, 22, 23]]])
To respond to my own post, after a bit of digging, there is a much
faster way.
Coerce my list to a numarray:
bigList = inputarray(bigList,Float64)
Then just change its shape:
dims = [self.DUTS,self.UUTS,..,self.MEASURED]
dims.reverse()
dims = tuple(dims)
bigList.setshape(dims)
Stephen Boulet wrote: I have a long list of floats (1613808 elements long). It takes quite a while to load this into a 7 dimensional Numeric array.
Is there any obvious way to speed this up?
def insertData(self,data):
# Start off with an array of the desired size # "self.MEASURED", etc., are integers arrayData = zeros([self.MEASURED, self.SWEPT, \ self.TEMPS,self.DCS, self.IVS, self.UUTS, \ self.DUTS], Float64)
i = 0
for device in range(self.DUTS): for unit in range(self.UUTS): for iv in range(self.IVS): for dc in range(self.DCS): for temp in range(self.TEMPS): for swept in range(self.SWEPT): for measured in range(self.MEASURED):
arrayData[measured][swept][temp][dc][iv][unit][device] = bigList[i] i += 1 return arrayData
Stephen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Hilde Roth |
last post by:
This may have been asked before but I can't find it. If I have
a rectangular list of lists, say, l = ,,], is
there a handy syntax for retrieving the ith item of every sublist?
I know about for i...
|
by: Gary Ruben |
last post by:
I have a class factory problem. You could say that my main problem is
that I don't understand class factories.
My specific problem:
I have a class with several methods I've defined.
To this class...
|
by: Sergey Olefir |
last post by:
Hello!
I am planning to use unique IDs in the little system I am building. Now
being more than a little paranoid (and having no idea about expected loads),
I am wary of using int4 as a basis for...
|
by: SuffrinMick |
last post by:
Hello - I'm a newbie to coding!
I'm working on an access 2000 database which has three tables:
tblContacts - A list of customer contacts.
tblOrgTypes - A list of organisational types....
|
by: Joe |
last post by:
I have the following 3 tables:
Clients, which has a numeric PK field called CLIENT_ID
Languages, which has a numeric PK field called LANGUAGE_ID
Client_Languages, which has a unique PK and...
|
by: Joe |
last post by:
I have 2 multi-list boxes, 1 displays course categories based on a
table called CATEGORIES. This table has 2 fields CATEGORY_ID,
CATEGORY_NAME
The other multi-list box displays courses based on...
|
by: Paul |
last post by:
Hi,
When should I use a list (in table properties: like
Ford;Mercedes;BMW;Audi )
and when should I use a lookup table??
And second question: IF I use a lookup table, should I always make a...
|
by: dkelly925 |
last post by:
Is there a way to add an If Statement to the following code so if data
in a field equals "x" it will launch one report and if it equals "y" it
would open another report. Anyone know how to modify...
|
by: John Wright |
last post by:
I have a long process I run that needs to be complete before the user can continue. I can change the cursor to an hourglass, but I want to update the Status Strip on the bottom during the process. ...
|
by: trose178 |
last post by:
Good day all, I am working on a multi-select list box for a standard
question checklist database and I am running into a syntax error in
the code that I cannot seem to correct. I will also note...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |