Here is part of my code:
import numpy as np
import pyfits
from astropy.io import ascii
def create_randoms(min_z,max_z,min_mass):
Do some calculations and use it to
write into a file
if (max_z == 1.0 and min_mass == 1e13):
ascii.write(data_1, '/home/Documents/0.0_zphot_1.0.dat', Writer=ascii.FixedWidthNoHeader, delimiter=None)
Exactly in the if statement, I get the error:
TypeError: unsupported operand type(s) for &: 'float' and 'float'
I call the function by:
create_randoms(0.0,1.0,1e13)
I don't know why it doesn't seem to like the values 1.0 and 1e13. I am not using the bitwise & here, and instead I am correctly using the logical operator and. But still it is throwing me with the error.
EDIT:
Full error traceback:
TypeError Traceback (most recent call last)
<ipython-input-83-d5f507b12cc0> in <module>()
----> 1 create_randoms(0.0,1.0,1e13,0,0,1,0,0,0,0,1)
/home/ssridhar/Documents/PhD_materials/Python/correlation_func/100_Hband_halos/jackknife_random_creation.py in create_randoms(min_z, max_z, min_mass, r1, r2, r3, r4, d1, d2, d3, d4)
119 """ WRITING FILES ACCORDINGLY """
120
--> 121 if (max_z == '1.0' and min_mass == '1e13'):
122 ascii.write(data_1, '/home/ssridhar/Documents/PhD_materials/2pt_correlation_master_2/Input/100_Hband_halos/jackknife/M200>1e13/K1_100sq_M200>1e13_xyz_0.0<zphot0.001<1.0.dat', Writer=ascii.FixedWidthNoHeader, delimiter=None)
123
TypeError: unsupported operand type(s) for &: 'float' and 'float'
Aucun commentaire:
Enregistrer un commentaire