Purge unused data (e.g. particle system, or groups) by script How can I completely remove a objects (e.g. particle system or groups used in particle systems) in blender using python?

The problem is this: I have a script, with which I create a scene (e.g. adding some normal objects and some group of objects with a particle system). For a research study I would like to repeat that that several times, without restarting blender. So I can create a scene, delete everything, e.g. with a script like this:

import bpy
scn = bpy.context.scene
for obj in scn.objects:
    obj.select = True
bpy.ops.object.delete()


If I rerun the script to recreate the scene with objects using particle system, the latter is not shown in the scene anymore (only the placeholders of the particle system). Now I'm not sure where exactly the problem lies, but I guess not everything is immediately deleted, running the script above. Only the startup of blender helps (but that's not what I want) or pushing the purge button. The purge button seems to start the command:

bpy.ops.outliner.orphans_purge()


But I can't get this piece of code to run in the console. It says that "the context is incorrect". Is there a way to purge the unused data by python script? Thanks a lot for any help.
To permanently delete curve data blocks that have no users  without reloading the project file (which can be bit problematic at times), you can use this python code:

import bpy
from bpy import data as D

for block in D.curves:
    if block.users == 0:
        D.curves.remove(block)


It'll iterate through all data blocks of type "Curve" and delete them if they have no users.