<jupyter_start><jupyter_text>We can move the A and B axes with step_a(n_steps) or set_a(angle in radians). A is the inner circle, B the outer.<jupyter_code>step_a(30)
step_b(300)<jupyter_output><empty_output><jupyter_text>Let's take one really detailed scan using the B axis to see what our beam shape looks like. 0 to 180 degrees by stepping B 640 times (half a revolution) reading the adc 3 times each position and averaging:<jupyter_code>noise = []
s10 = []
for b in range(100):
    val = 0
    for i in range(1):
        val += int(read_adc().strip())
    noise.append(val)
    val2 = 0
    for i in range(1):
        val2 += int(read_adc16().strip())
    s10.append(val2/15)
plt.plot(noise)
plt.plot(s10)
ser.read_all()<jupyter_output><empty_output><jupyter_text>A and B are now centered opposite eachother, with the LED opposite the PT<jupyter_code>fn = 'sc_test20_n'
# Taking one set of readings as a baseline (no object)
step_b(-200)
base = []
for b in range(400):
    base.append(int(read_adc().strip()))
    step_b(1)
step_b(-200)
                
plt.plot(base)
b = pd.DataFrame(base)
b.to_csv(fn + 'base.csv', index = False)
# Now, doing these scans from several angles. Doing 32 As (views/thetas), 64 Bs for each A (64 sensors)
from IPython.display import clear_output
readings = []
nv=32
nd = 400 # Hard coded for now
for a in range(nv):
    print(a)
    line = []
    step_b(-200)
    for b in range(400):
        line.append(int(read_adc().strip()))
        step_b(1)
    readings.append(line)
    step_a(int(-640/nv)) # A has 640 steps in 360 degrees.
    step_b(-200) # return to start
    
#     plt.plot(line)
#     plt.show()
    clear_output(wait=True)
    
    time.sleep(1)
    

# We return A to start to ensure we haven't missed steps    
# step_a(-640)  

# Save the scan
d = pd.DataFrame(readings)
d.to_csv(fn+'_' + str(nv) + 'v_' + str(nd) + 'd.csv', index=False)
fn
plt.plot(np.asarray(readings).T)
a =[]
for i in range(100):
    a.append(read_adc())
    time.sleep(0.1)
plt.plot(a)
b =[]
for i in range(100):
    b.append(read_adc())
print(b[:10])
plt.plot(b)
a
# Now, doing these scans from several angles. Doing 32 As (views/thetas), 64 Bs for each A (64 sensors)
readings = []
for a in range(64):
    line = []
    for b in range(400):
        line.append(int(read_adc16().strip()))
        step_b(1)
    readings.append(line)
    step_a(10) # A has 640 steps in 360 degrees. Scanning from 32 different views
    step_b(-400) # return to start
    print(a)

# We return A to start to ensure we haven't missed steps    
step_a(-640)  

# Save the scan
d = pd.DataFrame(readings)
d.to_csv(fn + '_64v_400d.csv', index=False)
plt.plot(readings[0])
plt.plot(noise)
plt.plot(s10)
n = pd.DataFrame({'A':noise, 'B':s10})
n.describe()
n.plot(kind='density')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13691322901849218, 'fraction_numerical': 0.04587482219061166, 'mean_word_length': 3.5008, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '583367', 'license': 'MIT', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1051, 'n_words': 306, 'path': 'Misc Notebooks/Data aquisition.ipynb', 'repo_name': 'johnowhitaker/CIRTS', 'size': '2812'}