<jupyter_start><jupyter_text>Data path setting<jupyter_code>data_path = '/gpfs/exfel/data/user/juncheng/crystalProject/data/simulation/'
out_path = "xstal/xstal_diffr_1"
# Remove previous results
shutil.rmtree(data_path+out_path,True)
os.chdir(data_path)
os.getcwd()<jupyter_output><empty_output><jupyter_text>Configure photon beam properties<jupyter_code>beamParam = PhotonBeamParameters(
    photon_energy = 4972.0 * electronvolt,  # photon energy in eV
    beam_diameter_fwhm=130e-9 * meter,      # focus diameter in m
    pulse_energy=100e-3 * joule,           # pulse energy in J
    photon_energy_relative_bandwidth=0.003, # relative bandwidth dE/E
    divergence=0.0 * radian,                # Beam divergence in rad
    photon_energy_spectrum_type='tophat',   # Spectrum type. Acceptable values are "tophat", "SASE", and "twocolor")
    )<jupyter_output><empty_output><jupyter_text>Configure detector geometry<jupyter_code>panel = DetectorPanel(ranges={"fast_scan_min" : 0, "fast_scan_max" : 999,
                              "slow_scan_min" : 0, "slow_scan_max" : 999},
                      pixel_size=220.0e-6*meter,
                      energy_response=1.0/electronvolt,
                      distance_from_interaction_plane=0.13*meter,
                      corners={"x" : -500, "y": -500},
                      saturation_adu=1.e6,
                      )
detector_geometry = DetectorGeometry(panels=panel)<jupyter_output><empty_output><jupyter_text>Set diffractor parameters and pass beam & detector parameters to diffractor<jupyter_code>diffParam = CrystFELPhotonDiffractorParameters(
    sample='3WUL.pdb',                    # Looks up pdb file in cwd, if not found, queries from RCSB pdb mirror.
    uniform_rotation=True,                # Apply random rotation
    number_of_diffraction_patterns=1,   #
    powder=False,                         # Set to True to create a virtual powder diffraction pattern (unested)
    intensities_file=None,                # File that contains reflection intensities. If set to none, use uniform intensity distribution
    crystal_size_range=[1e-7,1e-7],       # Range ([min,max]) in units of metres of crystal size.
    poissonize=False,                     # Set to True to add Poisson noise.
    number_of_background_photons=0,       # Change number to add uniformly distributed background photons.
    suppress_fringes=False,               # Set to True to suppress side maxima between reflection peaks.
    beam_parameters=beamParam,                 # Beam parameters object from above
    detector_geometry=detector_geometry,      # External file that contains the detector geometry in CrystFEL notation.
    )

diffractor = CrystFELPhotonDiffractor(
    parameters=diffParam,
    output_path=out_path)<jupyter_output>Checking presence of 3WUL.pdb. Will query from PDB if not found in $PWD.
Sample path is set to 3WUL.pdb.<jupyter_text>Launch simulation<jupyter_code>diffractor.backengine()
diffractor.saveH5()<jupyter_output>['pattern_sim', '-p3WUL.pdb', '--geometry=/tmp/tmpj2wfal6a.geom', '--output=/gpfs/exfel/data/user/juncheng/crystalProject/data/simulation/xstal/xstal_diffr_1/diffr_out_0000001.h5', '--number=1', '--random-orientation', '--really-random', '--photon-energy=4972.000000', '--beam-bandwidth=0.003000', '--nphotons=1.255332e+14', '--beam-radius=6.500000e-08', '--spectrum=tophat']<jupyter_text>Analysis<jupyter_code>analysis = DiffractionAnalysis(diffractor.output_path)
analysis.plotPattern()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10034207525655645, 'fraction_numerical': 0.029646522234891677, 'mean_word_length': 3.504492939666239, 'pattern_counts': {'":': 1, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '482596', 'license': 'MIT', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1112, 'n_words': 224, 'path': 'src/controller/crystFEL/DemoNote.ipynb', 'repo_name': 'ejcjason/crystalProject', 'size': '3508'}