On the other hand, if you know that the band gap is direct at the Gamma point, it's overkill to use the Custom Analyzer.
In that case you can use this script:
import sys
b = nlread(sys.argv[1], BulkConfiguration)[0]
t = Bandstructure(b, route=['G','G'], points_per_segment=2)
vbmax_ix = numpy.where(t.evaluate()[0]<=0.*eV)[0][-1]
cbmin_ix = numpy.where(t.evaluate()[0]>=0.*eV)[0][0]
bandgap = t.evaluate()[0][cbmin_ix]-t.evaluate()[0][vbmax_ix]
print "Direct band gap at Gamma point", bandgap
Save it as bandgap_at_G.py and run
atkpython bandgap_at_G.py silicene.nc
where silicene.nc is the assumed filename of your calculation, which furthermore is assumed to contain only one BulkConfiguration. If you have more than one, change the first line of the script to read e.g. the specific object ID (which you can see in VNL). You could do
import sys
b = nlread(sys.argv[1], object_id=sys.argv[2])[0]
t = Bandstructure(b, route=['G','G'], points_per_segment=2)
vbmax_ix = numpy.where(t.evaluate()[0]<=0.*eV)[0][-1]
cbmin_ix = numpy.where(t.evaluate()[0]>=0.*eV)[0][0]
bandgap = t.evaluate()[0][cbmin_ix]-t.evaluate()[0][vbmax_ix]
print "Direct band gap at Gamma point", bandgap
and run as
atkpython bandgap_at_G.py silicene.nc gID001
if you have run an optimization and gID001 is the relevant config in the NC file you want to compute the band gap for.