You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey covasim team, thanks again for opensourcing this simulator. I'm asking this question on the public github so other people get to benefit as well from your answers. Best regards, Rob
Describe the bug
Some layers seem to define contacts between two identical agents. For example, contacts[layer]['p1'][i] == contacts[layer]['p2'][i] for some i. Is this expected or is this a bug?
To reproduce
Run a simulation like in the tutorial5.ipynb
Use as subtarget function for test_num the following:
def subtarget_func(sim):
contacts = sim.people.contacts
for layerkey in contacts.keys():
num_selfcontact = np.sum(
contacts[layerkey]['p1'] == contacts[layerkey]['p2'])
if num_selfcontact > 0:
print(f"Found {num_selfcontact} contacts in layer {layerkey}")
# Baseline intervention
vals = np.ones(len(sim.people)) # Create the array
vals[cv.true(sim.people.exposed)] = 100 # Probability for testing
output = dict(inds=sim.people.uid, vals=vals)
return output
Expected behavior
I would expect that a simulator wouldn't simulate a contact between the identical agent, unless this contact has a special meaning?
Screenshots or outputs
The above subtarget function will print an output like the following. The num_selfcontact differs randomly between runs, but is usually around 5 to 50.
All layers: ['h', 's', 'w', 'c']
Found 8 contacts in layer s
Found 13 contacts in layer w
Found 7 contacts in layer c
Platform (please complete the following information):
Covasim version: 3.1.4
Python 3.9 on Ubuntu 22
The text was updated successfully, but these errors were encountered:
Hi @RobRomijnders -- well spotted, you're right! In Covasim's default "hybrid" network, we don't bother to remove self-connections, because they have (virtually) no effect on the network, and are computationally costly to find and remove. However, other network options -- such as SynthPops -- do have self-connections removed. We'll add this to the FAQ, because you probably aren't the only person who was confused by this.
Hey covasim team, thanks again for opensourcing this simulator. I'm asking this question on the public github so other people get to benefit as well from your answers. Best regards, Rob
Describe the bug
Some layers seem to define contacts between two identical agents. For example,
contacts[layer]['p1'][i] == contacts[layer]['p2'][i]
for some i. Is this expected or is this a bug?To reproduce
Expected behavior
I would expect that a simulator wouldn't simulate a contact between the identical agent, unless this contact has a special meaning?
Screenshots or outputs
The above subtarget function will print an output like the following. The
num_selfcontact
differs randomly between runs, but is usually around 5 to 50.Platform (please complete the following information):
The text was updated successfully, but these errors were encountered: