I did my best to find a solution on my own, but I just do not raise anything important. I have several numpy arrays that are extracted from .tbl files (this is an astronomical table format that I extract using atpy). Each array has about 25,000 numbers, and I draw them as a scatter plot with matplotlib. The values ββof the Y axis come directly from the array, the x axis is a simple subtraction of the values ββin two separate arrays.
Which is all good, but I really need to do this, to extract values ββthat fall into a certain range (for example, I need values ββfor y that fall between 10 and 13, and x values ββbetween 0 and 1). Of course, for the conspiracy to work, these values ββmust coincide with each other. Here is what I have:
import numpy as np from numpy import ndarray import matplotlib.pyplot as plt import matplotlib import atpy twomass = atpy.Table() twomass.read('/Raw_Data/IRSA_downloads/2MASS_GCbox1.tbl') hmag = list([twomass['h_m']]) jmag = list([twomass['j_m']]) colorjh = list([jh for j,h in zip(jmag, hmag)]) x = [] y = [] def list_maker(): for c,h in zip(colorjh, hmag): if np.all(c) < 1 == True and np.all(c) > 0 == True and np.all(h) < 13 == True and np.all(h) > 10 == True: x.append(c) y.append(h) list_maker() plt.scatter(x, y, c='g', s=1, alpha=0.05) plt.xlabel('Color(JH)', fontsize=15)
I also tried this method for slicing data, but no luck:
colorjh = colorjh[colorjh<1] colorjh = colorjh[colorjh>0]
I tried many different things, including trying to turn these arrays into lists and many different things with inequality formatting. In this process, I may have walked away from the answer, but this code at least prints the entire spread (it cannot reduce the data as I want). Some other iterations printed blank stories anywhere near the range of numbers I'm looking for.
I am new to python and on this site, so please be as clear as possible with any tips, etc. If it's super-jargon, I may not be able to make good use of your offer. Thanks to all.