Utility functions

These are functions intended to help process the outputs from RayFlare.

rayflare.utilities.get_matrices_or_paths(structpath, surf_name, front_or_rear, prof_layers=None, overwrite=False)
rayflare.utilities.get_savepath(save_location, project_name)

Returns the full path where matrices will be stored.

Parameters:
  • save_location

    string - location where the calculated redistribution matrices should be stored. Currently recognized are:

    • ’default’, which stores the results in folder in your home directory called ‘RayFlare_results’

    • ’current’, which stores the results in the current working directory

    • or you can specify the full path location for wherever you want the results to be stored.

    In each case, the results will be stored in a subfolder with the name of the project (options.project_name)

  • project_name – the project name (string)

Returns:

full file path where matrices are stored (string)

rayflare.utilities.get_wavelength(options)
rayflare.utilities.make_absorption_function(result, structure, options)
Parameters:
  • result – the result of an optical calculation; this can be from using the angular redistribution matrix method, or from using rt_structure().calculate, tmm_structure.calculate() or rcwa_structure.calculate(). This should be the full result of the calculation, not just the absorption profile.

  • structure – the structure object used to calculate the result; this can be a Structure object, a tmm_structure object, a rcwa_structure object or a rt_structure object.

  • options – the options used to calculate the optical result.

Returns:

all_positions, diff_absorb_fn. a list of positions along the structure (in units of m), and a function that can be used to calculate the absorption at any position along the structure (in units of m-1). This includes all the layers which were present in structure, not just those where absorption profiles were requested (if relevant).