Request clarification of sort order

Questions, answers, discussions related to the FIND Technologies Inc. challenge

Request clarification of sort order

Postby tgflynn » Mon May 16, 2011 4:04 am

Could you confirm that the submitted classes should be sorted in ascending order by the numerical order of the numerical part of their filenames, rather than in lexicographic order ?

In other words is the correct order for the numbers 1-10 :
1 2 3 4 5 6 7 8 9 10

rather than

1 10 2 3 4 5 6 7 8 9

?

Though the wording of the task description strongly implies numeric order, I wanted to confirm this since there's no other way to verify the order.

Thank you.
tgflynn
 
Posts: 2
Joined: Mon Dec 20, 2010 10:38 pm

Re: Request clarification of sort order

Postby TunedIT » Mon May 16, 2011 5:34 pm

Hi.
Yes, it's numeric order. We've changed now the naming of files in final.zip and preliminary.zip to 0001, 0002, ..., to avoid confusion. Thanks for pointing this out.
TunedIT
 
Posts: 26
Joined: Fri Oct 09, 2009 6:45 pm

Re: Request clarification of sort order

Postby leec » Mon May 16, 2011 11:09 pm

To avoid killing tunedit's bandwidth in re-downloading here is a simple way to properly sort the files in python.
Code: Select all
import glob
files = glob.glob("*.lvm")

unsorted = []
for f in files:
    fnum = int(f.split("_")[0])
    unsorted.append((fnum,f))
unsorted.sort()

dat = [] 
for f in unsorted:
    <file names are now sorted numerically>

leec
 
Posts: 3
Joined: Fri May 13, 2011 6:30 pm


Return to Materials Identification Based on Measurements of Electromagnetic Radiation

Who is online

Users browsing this forum: No registered users and 1 guest

cron