Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel v1.0.2 #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
Please refer to the charge acceptance testing documentation for the most up to date instructions.
Please refer to the charge acceptance testing documentation for the most up to date instructions: https://docs.google.com/document/d/1xePnbIQYTACgnkbCunTGQitOliaqGP7bb6tcuGjYnOI/edit?usp=sharing


## For users

The larpix-control software is a prerequisite. To get the latest tagged version:
```
pip3 install larpix-control
```
To get a tagged version of the QC test scripts contained in this repository:
```
git clone -b v1.0.1 https://github.com/larpix/larpix-10x10-scripts.git
```
## For developers

Development for the next tag happens in a branch named devel_vX.Y.Z
This branch will eventually be tagged as vX.Y.Z pulled into main.
For example, after tagging v.1.0.1:
```
git clone -b v1.0.1 git@github.com:larpix/larpix-10x10-scripts.git
cd larpix-10x10-scripts
git checkout -b devel_v1.0.2
<make edtis, git add, git commit>
git push -u origin devel_v1.0.2
```
Developers can continue to push to this branch until it is ready to be validated and tagged.
File renamed without changes.
2 changes: 1 addition & 1 deletion check_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def main(io_group=_default_io_group,

###### disable tile power
c.io.set_reg(0x00000010, 0, io_group=io_group)

return c


Expand Down
3 changes: 2 additions & 1 deletion generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
_name = 'tile-6'
_excluded_chips = []
_good_root_connections = [11, 41, 71, 101]
_io_group = 1
_io_channels = [21, 22, 23, 24]
_excluded_links = [ (61, 71), (24, 34), (44, 43), (64, 74), (49, 59), (43, 44), (22, 32)]
_paths = None
_default_io_group = 1


_header = {"_config_type": "controller", "layout": "2.5.0", "network" : dict()}
_header = {"_config_type": "controller", "layout": "2.4.0", "network" : dict()}



Expand Down
10 changes: 5 additions & 5 deletions multi_trigger_rate_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@

def initial_setup(ctr, controller_config, tile_id):
now = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
fname="-trigger_rate_%s_" % suffix[ctr] #str(rate_cut[ctr])
fname=tile_id+fname+str(now)+".h5"
fname="-trigger-rate-%s-" % suffix[ctr] #str(rate_cut[ctr])
fname=tile_id+fname+str(now)+'_'+str(base.LARPIX_10X10_SCRIPTS_VERSION)+".h5"
c = base.main(controller_config, logger=True, filename=fname, enforce=False)
return c, fname

def initial_setup_low_dac(controller_config, tile_id):
now = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
fname="-low_thresh_trigger_rate_"#str(rate_cut[ctr])
fname=tile_id+fname+str(now)+".h5"
fname="-low-thresh-trigger-rate-"#str(rate_cut[ctr])
fname=tile_id+fname+str(now)+'_'+str(base.LARPIX_10X10_SCRIPTS_VERSION)+".h5"
c = base.main(controller_config, logger=True, filename=fname, enforce=False)
return c, fname

Expand Down Expand Up @@ -336,7 +336,7 @@ def save_do_not_enable_list(forbidden,tile_id):
if ck not in d: d[ck]=[]
if p[1] not in d[ck]: d[ck].append(p[1])
now = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
with open(tile_id+'-trigger-rate-DO-NOT-ENABLE-channel-list-'+now+ '_v' + str(base.LARPIX_10X10_SCRIPTS_VERSION) +'.json','w') as outfile:
with open(tile_id+'-trigger-rate-disabled-list-'+now+ '_' + str(base.LARPIX_10X10_SCRIPTS_VERSION) +'.json','w') as outfile:
json.dump(d, outfile, indent=4)
return

Expand Down
14 changes: 7 additions & 7 deletions pedestal_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,19 @@ def main(controller_config=_default_controller_config,
now = time.strftime("%Y_%m_%d_%H_%M_%S_%Z")
tile_id = 'tile-id-' + controller_config.split('-')[2]
ped_fname="-pedestal-%s" % now

if disabled_list:
print('applying disabled list: ',disabled_list)
with open(disabled_list,'r') as f: disabled_channels = json.load(f)
ped_fname=tile_id+ped_fname+"_"+str(disabled_list.split(".json")[0])
ped_fname="-pedestal_%s" % now
if disabled_list:
print('applying disabled list: ',disabled_list)
with open(disabled_list,'r') as f: disabled_channels = json.load(f)
ped_fname=tile_id+ped_fname+"____"+str(disabled_list.split(".json")[0])
else:
nonrouted_channels=[6,7,8,9,22,23,24,25,38,39,40,54,55,56,57] # channels NOT routed out to pixel pads for LArPix-v2
disabled_channels["All"]=nonrouted_channels
print('No disabled list applied. Using the default bad channels list.')
ped_fname=tile_id+ped_fname+"-default-disabled-channels"
ped_fname= ped_fname+".h5"

ped_fname= ped_fname+'-'+str(base.LARPIX_10X10_SCRIPTS_VERSION)+".h5"

print('initial disabled list: ',disabled_channels)

c = base.main(controller_config=controller_config, logger=True, filename=ped_fname, vdda=0)
Expand All @@ -214,7 +212,9 @@ def main(controller_config=_default_controller_config,
print('\n\n\n===========\t',n_bad_channels,' bad channels\t ===========\n\n\n')

if no_refinement==False:
ped_fname=tile_id+"-recursive-pedestal_%s" % revised_bad_channel_filename

ped_fname=tile_id+"-recursive-pedestal_%s.h5" % revised_bad_channel_filename

c = base.main(controller_config=controller_config, logger=True, filename=ped_fname, vdda=0)
#c = base.main(controller_config=controller_config, logger=True, filename=ped_fname)
configure_pedestal(c, periodic_trigger_cycles, revised_disabled_channels)
Expand Down
14 changes: 10 additions & 4 deletions plot_hydra_network_v2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@

def parse_hydra_network(network_json, iog):
chipID_uart, missingIO=[{} for i in range(2)]
version=None
with open(network_json,'r') as f:
data = json.load(f)
for key in data.keys():
if key=="larpix-scripts-version":
version = data[key]
continue
missingIO=data['bad_uart_links']
mapping=data['network']['miso_us_uart_map']
hydra=data['network'][str(iog)]
Expand All @@ -24,7 +29,7 @@ def parse_hydra_network(network_json, iog):
chipID_uart[node['chip_id']]=[]
for i in range(len(node['miso_us'])):
if node['miso_us'][i]!=None: chipID_uart[node['chip_id']].append(mapping[i])
return chipID_uart, missingIO
return chipID_uart, missingIO, version



Expand All @@ -48,7 +53,7 @@ def start_end(chipID, uart, chipid_pos):



def plot_hydra_network(geometry_yaml, chipID_uart, missingIO, tile_id, pacman_tile, io_group):
def plot_hydra_network(geometry_yaml, chipID_uart, missingIO, tile_id, pacman_tile, io_group, version):
with open(geometry_yaml) as fi: geo = yaml.full_load(fi)
chip_pix = dict([(chip_id, pix) for chip_id,pix in geo['chips']])
vertical_lines=np.linspace(-1*(geo['width']/2), geo['width']/2, 11)
Expand All @@ -66,6 +71,7 @@ def plot_hydra_network(geometry_yaml, chipID_uart, missingIO, tile_id, pacman_ti
ax.vlines(x=vl, ymin=horizontal_lines[0], ymax=horizontal_lines[-1], colors=['k'], linestyle='dotted')
for hl in horizontal_lines:
ax.hlines(y=hl, xmin=vertical_lines[0], xmax=vertical_lines[-1], colors=['k'], linestyle='dotted')
plt.text(0.95,1.01,'LArPix '+str(version), ha='center', va='center', transform=ax.transAxes)

chipid_pos = dict()
for chipid in chip_pix.keys():
Expand Down Expand Up @@ -120,8 +126,8 @@ def main(controller_config=_default_controller_config, geometry_yaml=_default_ge
tile_id = controller_config.split('-')[2]
pacman_tile = controller_config.split('-')[5]

chipID_uart, missingIO = parse_hydra_network(controller_config, io_group)
plot_hydra_network(geometry_yaml, chipID_uart, missingIO, tile_id, pacman_tile, io_group)
chipID_uart, missingIO, version = parse_hydra_network(controller_config, io_group)
plot_hydra_network(geometry_yaml, chipID_uart, missingIO, tile_id, pacman_tile, io_group, version)



Expand Down
14 changes: 11 additions & 3 deletions plot_xy_disabled_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def parse_file(filename):
with open(filename,'r') as f:
data = json.load(f)
for key in data.keys():
if key=='All': continue
if key=="larpix-scripts-version":
version = data[key];
continue
Expand Down Expand Up @@ -53,7 +54,7 @@ def plot_xy(trigger, pedestal, tile_id, geometry_yaml, version):
for hl in horizontal_lines:
ax.hlines(y=hl, xmin=vertical_lines[0], xmax=vertical_lines[-1], colors=['k'], linestyle='dotted')

plt.text(0.95,1.01,'LArPix version '+str(version), ha='center', va='center', transform=ax.transAxes)
plt.text(0.95,1.01,'LArPix '+str(version), ha='center', va='center', transform=ax.transAxes)
chipid_pos = dict()
for chipid in chip_pix.keys():
x,y = [[] for i in range(2)]
Expand All @@ -69,13 +70,17 @@ def plot_xy(trigger, pedestal, tile_id, geometry_yaml, version):
for key in trigger.keys():
chip_id = key
if chip_id not in range(11,111): continue
nchan = len(trigger[key])
for channel_id in trigger[key]:
trigger_count+=1
x = geo['pixels'][chip_pix[chip_id][channel_id]][1]
y = geo['pixels'][chip_pix[chip_id][channel_id]][2]
weight = 1.0
weight = 0.5
r = Rectangle( ( x-(pitch/2.), y-(pitch/2.) ), pitch, pitch, color='r', alpha=weight )
plt.gca().add_patch( r )
posX=chipid_pos[chip_id]['avgX']
posY=chipid_pos[chip_id]['avgY']-abs(chipid_pos[chip_id]['avgY']-chipid_pos[chip_id]['minY'])/2.
plt.annotate(nchan, [posX,posY], ha='center', va='center', color='r')

pedestal_count=0
for key in pedestal.keys():
Expand All @@ -85,9 +90,12 @@ def plot_xy(trigger, pedestal, tile_id, geometry_yaml, version):
pedestal_count+=1
x = geo['pixels'][chip_pix[chip_id][channel_id]][1]
y = geo['pixels'][chip_pix[chip_id][channel_id]][2]
weight = 1.0
weight = 0.5
r = Rectangle( ( x-(pitch/2.), y-(pitch/2.) ), pitch, pitch, color='orange', alpha=weight )
plt.gca().add_patch( r )
posX=chipid_pos[chip_id]['avgX']
posY=chipid_pos[chip_id]['avgY']-abs(chipid_pos[chip_id]['avgY']-chipid_pos[chip_id]['minY'])
plt.annotate(nchan, [posX,posY], ha='center', va='center', color='orange')

ax.set_title('Tile ID '+str(tile_id))
if trigger_count!=0 and pedestal_count==0:
Expand Down