In [3]:
from subprocess import call
%pylab inline


Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].
For more information, type 'help(pylab)'.

In [4]:
def data_base_query(query, outputfile, password, username="forero"):
    website = "http://wget.multidark.org/MyDB?action=doQuery&SQL="
    wget_options="--auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt" 
    wget_options=wget_options+" -O "+outputfile +" "
    wget_command="wget --http-user="+username+" --http-passwd="+password+" "+wget_options
    command = wget_command + "\""+ website + query+"\""
    print command
    retcode = call(command,shell=True)

In [18]:
get_data = True
id_to_get = 85
delta_z = 40.0
min_z_array = arange(0.0,1000.0,delta_z)
max_z_array = min_z_array + delta_z
print min_z_array
print max_z_array
if get_data:
    for min_z, max_z in zip(min_z_array, max_z_array):
        query = "select * from MDR1..BDMW where snapnum = %d and z between %f and %f and Mtot > 5e13"%(id_to_get, min_z, max_z)
        outputfile = "../data/MDR1_BDMW_snap_%d_z_%.1f_%.1f.csv"%(id_to_get, min_z, max_z)
        data_base_query(query, outputfile, username="pasi", password="guatemala")


[   0.   40.   80.  120.  160.  200.  240.  280.  320.  360.  400.  440.
  480.  520.  560.  600.  640.  680.  720.  760.  800.  840.  880.  920.
  960.]
[   40.    80.   120.   160.   200.   240.   280.   320.   360.   400.
   440.   480.   520.   560.   600.   640.   680.   720.   760.   800.
   840.   880.   920.   960.  1000.]
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_0.0_40.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 0.000000 and 40.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_40.0_80.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 40.000000 and 80.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_80.0_120.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 80.000000 and 120.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_120.0_160.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 120.000000 and 160.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_160.0_200.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 160.000000 and 200.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_200.0_240.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 200.000000 and 240.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_240.0_280.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 240.000000 and 280.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_280.0_320.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 280.000000 and 320.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_320.0_360.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 320.000000 and 360.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_360.0_400.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 360.000000 and 400.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_400.0_440.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 400.000000 and 440.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_440.0_480.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 440.000000 and 480.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_480.0_520.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 480.000000 and 520.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_520.0_560.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 520.000000 and 560.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_560.0_600.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 560.000000 and 600.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_600.0_640.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 600.000000 and 640.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_640.0_680.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 640.000000 and 680.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_680.0_720.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 680.000000 and 720.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_720.0_760.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 720.000000 and 760.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_760.0_800.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 760.000000 and 800.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_800.0_840.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 800.000000 and 840.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_840.0_880.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 840.000000 and 880.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_880.0_920.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 880.000000 and 920.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_920.0_960.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 920.000000 and 960.000000 and Mtot > 5e13"
wget --http-user=pasi --http-passwd=guatemala --auth-no-challenge --content-disposition --cookies=on --keep-session-cookies --save-cookies=cookie.txt --load-cookies=cookie.txt -O ../data/MDR1_BDMW_snap_85_z_960.0_1000.0.csv "http://wget.multidark.org/MyDB?action=doQuery&SQL=select * from MDR1..BDMW where snapnum = 85 and z between 960.000000 and 1000.000000 and Mtot > 5e13"

In [ ]: