-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mesa-origin' of [email protected]:LABSS/PROTON-OC.git
- Loading branch information
Showing
72 changed files
with
10,159 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
rp0.9.2_baseline_NOC_15.xml | ||
rp0.9.2_baseline_NOC_45.xml | ||
rp0.9.2_baseline_number-arrests-per-year_15.xml | ||
rp0.9.2_baseline_number-arrests-per-year_45.xml | ||
rp0.9.2_baseline_number-crimes-yearly-per10k_1000.xml | ||
rp0.9.2_baseline_number-crimes-yearly-per10k_3000.xml | ||
rp0.9.2_baseline_punishment-length_0.5.xml | ||
rp0.9.2_baseline_punishment-length_1.5.xml | ||
rp0.9.2_baseline_unemployment-multiplier_0.5.xml | ||
rp0.9.2_baseline_unemployment-multiplier_1.5.xml | ||
rp0.9.2_disruptive_NOC_15.xml | ||
rp0.9.2_disruptive_NOC_45.xml | ||
rp0.9.2_disruptive_number-arrests-per-year_15.xml | ||
rp0.9.2_disruptive_number-arrests-per-year_45.xml | ||
rp0.9.2_disruptive_number-crimes-yearly-per10k_1000.xml | ||
rp0.9.2_disruptive_number-crimes-yearly-per10k_3000.xml | ||
rp0.9.2_disruptive_punishment-length_0.5.xml | ||
rp0.9.2_disruptive_punishment-length_1.5.xml | ||
rp0.9.2_disruptive_unemployment-multiplier_0.5.xml | ||
rp0.9.2_disruptive_unemployment-multiplier_1.5.xml | ||
rp0.9.2_facilitators_NOC_15.xml | ||
rp0.9.2_facilitators_NOC_45.xml | ||
rp0.9.2_facilitators_number-arrests-per-year_15.xml | ||
rp0.9.2_facilitators_number-arrests-per-year_45.xml | ||
rp0.9.2_facilitators_number-crimes-yearly-per10k_1000.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
rp0.9.2_facilitators_number-crimes-yearly-per10k_3000.xml | ||
rp0.9.2_facilitators_punishment-length_0.5.xml | ||
rp0.9.2_facilitators_punishment-length_1.5.xml | ||
rp0.9.2_facilitators_unemployment-multiplier_0.5.xml | ||
rp0.9.2_facilitators_unemployment-multiplier_1.5.xml | ||
rp0.9.2_preventive_NOC_15.xml | ||
rp0.9.2_preventive_NOC_45.xml | ||
rp0.9.2_preventive_number-arrests-per-year_15.xml | ||
rp0.9.2_preventive_number-arrests-per-year_45.xml | ||
rp0.9.2_preventive_number-crimes-yearly-per10k_1000.xml | ||
rp0.9.2_preventive_number-crimes-yearly-per10k_3000.xml | ||
rp0.9.2_preventive_punishment-length_0.5.xml | ||
rp0.9.2_preventive_punishment-length_1.5.xml | ||
rp0.9.2_preventive_unemployment-multiplier_0.5.xml | ||
rp0.9.2_preventive_unemployment-multiplier_1.5.xml | ||
rp0.9.2_students_NOC_15.xml | ||
rp0.9.2_students_NOC_45.xml | ||
rp0.9.2_students_number-arrests-per-year_15.xml | ||
rp0.9.2_students_number-arrests-per-year_45.xml | ||
rp0.9.2_students_number-crimes-yearly-per10k_1000.xml | ||
rp0.9.2_students_number-crimes-yearly-per10k_3000.xml | ||
rp0.9.2_students_punishment-length_0.5.xml | ||
rp0.9.2_students_punishment-length_1.5.xml | ||
rp0.9.2_students_unemployment-multiplier_0.5.xml | ||
rp0.9.2_students_unemployment-multiplier_1.5.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import xml.etree.ElementTree as ET | ||
|
||
repetitions = "10" | ||
|
||
#pretty print method | ||
def indent(elem, level=0): | ||
i = "\n" + level*" " | ||
j = "\n" + (level-1)*" " | ||
if len(elem): | ||
if not elem.text or not elem.text.strip(): | ||
elem.text = i + " " | ||
if not elem.tail or not elem.tail.strip(): | ||
elem.tail = i | ||
for subelem in elem: | ||
indent(subelem, level+1) | ||
if not elem.tail or not elem.tail.strip(): | ||
elem.tail = j | ||
else: | ||
if level and (not elem.tail or not elem.tail.strip()): | ||
elem.tail = j | ||
return elem | ||
|
||
# ---------------------------------- | ||
version="rp0.9.2" | ||
|
||
variations={'number-crimes-yearly-per10k': [1000, 3000], | ||
'unemployment-multiplier': [1.5, 0.5], | ||
'number-arrests-per-year': [15, 45], | ||
'punishment-length': [1.5, 0.5] | ||
} | ||
|
||
for intervention in ['disruptive', | ||
'students', | ||
'baseline', | ||
'preventive', | ||
'facilitators']: | ||
|
||
# this goes by itself as it has a double set to do | ||
for nocc in [[15,6], [45,8]]: | ||
tree = ET.parse('rp_base.xml') | ||
root = tree.getroot() | ||
|
||
al = tree.find('.//enumeratedValueSet[@variable="intervention"]') | ||
for x in list(al): al.remove(x) | ||
al.insert(1, ET.Element("value", value='"'+intervention+'"')) | ||
|
||
al = tree.find('.//enumeratedValueSet[@variable="num-oc-persons"]') | ||
for x in list(al): al.remove(x) | ||
al.insert(1, ET.Element("value", value=str(nocc[0]))) | ||
al = tree.find('.//enumeratedValueSet[@variable="num-oc-families"]') | ||
for x in list(al): al.remove(x) | ||
al.insert(1, ET.Element("value", value=str(nocc[1]))) | ||
|
||
experiment = version + '_' + intervention + '_NOC_' + str(nocc[0]) | ||
al = tree.find('.//experiment') | ||
al.set('name', version) | ||
al.set('repetitions', repetitions) | ||
|
||
#write to file | ||
tree = ET.ElementTree(indent(root)) | ||
tree.write(experiment + '.xml', encoding='utf-8') | ||
|
||
for var in variations: | ||
for v in variations.get(var): | ||
tree = ET.parse('rp_base.xml') | ||
root = tree.getroot() | ||
|
||
al = tree.find('.//enumeratedValueSet[@variable="intervention"]') | ||
for x in list(al): al.remove(x) | ||
al.insert(1, ET.Element("value", value='"'+intervention+'"')) | ||
|
||
al = tree.find('.//enumeratedValueSet[@variable="' + var + '"]') | ||
for x in list(al): al.remove(x) | ||
al.insert(1, ET.Element("value", value=str(v))) | ||
|
||
experiment = version + '_' + intervention + "_" + var + "_" + str(v) | ||
al = tree.find('.//experiment') | ||
al.set('name', version) | ||
al.set('repetitions', repetitions) | ||
|
||
#write to file | ||
tree = ET.ElementTree(indent(root)) | ||
tree.write(experiment + '.xml', encoding='utf-8') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import xml.etree.ElementTree as ET | ||
|
||
repetitions = "10" | ||
|
||
#pretty print method | ||
def indent(elem, level=0): | ||
i = "\n" + level*" " | ||
j = "\n" + (level-1)*" " | ||
if len(elem): | ||
if not elem.text or not elem.text.strip(): | ||
elem.text = i + " " | ||
if not elem.tail or not elem.tail.strip(): | ||
elem.tail = i | ||
for subelem in elem: | ||
indent(subelem, level+1) | ||
if not elem.tail or not elem.tail.strip(): | ||
elem.tail = j | ||
else: | ||
if level and (not elem.tail or not elem.tail.strip()): | ||
elem.tail = j | ||
return elem | ||
|
||
# ---------------------------------- | ||
version="rp0.9.3" | ||
|
||
for intervention in ['disruptive', | ||
'preventive', | ||
'facilitators']: | ||
|
||
|
||
tree = ET.parse('rp_base.xml') | ||
root = tree.getroot() | ||
|
||
al = tree.find('.//enumeratedValueSet[@variable="intervention"]') | ||
for x in list(al): al.remove(x) | ||
al.insert(1, ET.Element("value", value='"'+intervention+'"')) | ||
|
||
experiment = version + '_' + intervention + "_" | ||
al = tree.find('.//experiment') | ||
al.set('name', version) | ||
al.set('repetitions', repetitions) | ||
|
||
#write to file | ||
tree = ET.ElementTree(indent(root)) | ||
tree.write(experiment + '.xml', encoding='utf-8') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rp0.9.3_disruptive_.xml | ||
rp0.9.3_facilitators_.xml | ||
rp0.9.3_preventive_.xml |
Oops, something went wrong.